Skip to content

Instantly share code, notes, and snippets.

@Anas-jaf
Created August 14, 2023 19:25
Show Gist options
  • Save Anas-jaf/9218b46290c1a8602316816b16b3f46d to your computer and use it in GitHub Desktop.
Save Anas-jaf/9218b46290c1a8602316816b16b3f46d to your computer and use it in GitHub Desktop.
# Define the path to the Firefox executable
$firefoxPath = "C:\Program Files\Mozilla Firefox\firefox.exe"
# Get a list of all PDF files in the current directory
$pdfFiles = Get-ChildItem -Path . -Filter *.pdf
# Loop through the list and open each PDF file with Firefox
foreach ($pdfFile in $pdfFiles) {
$pdfFilePath = $pdfFile.FullName
$escapedFilePath = "`"$pdfFilePath`"" # Escape path with quotes for spaces
Start-Process -FilePath $firefoxPath -ArgumentList $escapedFilePath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment