From a0a4cab0cfbba2fac03f7cf25d3973e81570a4aa Mon Sep 17 00:00:00 2001 From: s00ner Date: Tue, 17 Jun 2025 16:27:19 +0000 Subject: [PATCH] Add opener.ps1 added powershell script --- opener.ps1 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 opener.ps1 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."