@echo off rem File: universal_ps1_launcher.bat rem Purpose: launcher for get_remote_id_check.ps1 (finds pwsh or falls back to Windows PowerShell) rem Author: takraztak rem ================================================== setlocal :: try PowerShell 7 (pwsh) in Program Files set "PS_EXE=%ProgramFiles%\PowerShell\7\pwsh.exe" if exist "%ProgramFiles(x86)%" ( if not exist "%PS_EXE%" set "PS_EXE=%ProgramFiles(x86)%\PowerShell\7\pwsh.exe" ) :: fallback to Windows PowerShell if pwsh not found if not exist "%PS_EXE%" set "PS_EXE=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" :: final fallback: rely on PATH (just the name) if not exist "%PS_EXE%" ( set "PS_EXE=pwsh.exe" ) :: path to the PowerShell script with the same base name as this .bat set "PS1=%~dp0%~n0.ps1" :: Quote paths and forward all args "%PS_EXE%" -NoProfile -ExecutionPolicy Bypass -File "%PS1%" %* endlocal pause exit /b