commit a0a4cab0cfbba2fac03f7cf25d3973e81570a4aa Author: s00ner Date: Tue Jun 17 16:27:19 2025 +0000 Add opener.ps1 added powershell script diff --git a/opener.ps1 b/opener.ps1 new file mode 100644 index 0000000..0c2dfdf --- /dev/null +++ b/opener.ps1 @@ -0,0 +1,35 @@ +# Define the path to the text file containing the list of Excel file paths +$fileListPath = "C:\Path\To\filelist.txt" + +# Read all lines (file paths) from the text file +$filePaths = Get-Content -Path $fileListPath + +# Create an Excel application object +$excel = New-Object -ComObject Excel.Application +$excel.Visible = $true + +# Open each file in Excel +foreach ($file in $filePaths) { + if (Test-Path $file) { + Write-Host "Opening $file" + $workbook = $excel.Workbooks.Open($file) + } else { + Write-Host "File not found: $file" + } +} + +# Wait for 2 minutes (120 seconds) +Start-Sleep -Seconds 120 + +# Close all workbooks without saving +$excel.Workbooks.Close($false) + +# Quit Excel +$excel.Quit() + +# Release the COM object +[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel) | Out-Null +[GC]::Collect() +[GC]::WaitForPendingFinalizers() + +Write-Host "Excel closed after 2 minutes."