SET SCRIPTPATH=%~dpn0.ps1
REM PowerShell script isn't where it should be!
-IF NOT EXIST %SCRIPTPATH% (
- ECHO Could not find PowerShell script %SCRIPTPATH%. Is %~nx0 in the right folder?
+IF NOT EXIST "%SCRIPTPATH%" (
+ ECHO Could not find PowerShell script "%SCRIPTPATH%". Is %~nx0 in the right folder?
EXIT /B 1
)
IF NOT DEFINED PWSH (
IF NOT "%%~$PATH:X" == "" (
REM Found a PowerShell executable in the PATH
- SET PWSH=%%X
+ SET PWSH="%%X"
GOTO end_looking
)
)
)
REM Run the PowerShell script
-%PWSH% -NoProfile -ExecutionPolicy Bypass -Command "& '%SCRIPTPATH%' %*";
+"%PWSH%" -NoProfile -ExecutionPolicy Bypass -Command "& '%SCRIPTPATH%' %*";