@echo off for /f "delims=" %%i in ('where Get-Frame.ps1 2^>nul') do set "_script=%%i" & goto :found echo Error: Get-Frame.ps1 not found in PATH exit /b 1 :found set "_video=%~1" set "_frame=%~2" shift shift set "_rest=" :loop if "%~1"=="" goto done set "_rest=%_rest% %1" shift goto loop :done pwsh.exe -NoProfile -ExecutionPolicy Bypass -File "%_script%" -Video "%_video%" -Frame "%_frame%"%_rest%