Skip to content

Commit

Permalink
Run script using Windows Powershell if available
Browse files Browse the repository at this point in the history
  • Loading branch information
xd003 authored Oct 25, 2023
1 parent 0d68b12 commit d4eac50
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mpv-root/updater.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ if exist "%~dp0\installer\updater.ps1" (
) else (
set updater_script="%~dp0\updater.ps1"
)
powershell -noprofile -nologo -executionpolicy bypass -File %updater_script%

:: Check if pwsh is in the system's PATH
where pwsh >nul 2>nul
if %errorlevel% equ 0 (
:: pwsh is in PATH, so run the script using Windows Powershell
pwsh -NoProfile -NoLogo -ExecutionPolicy Bypass -File %updater_script%
) else (
:: pwsh is not in PATH, run the script using PowerShell Core
powershell -NoProfile -NoLogo -ExecutionPolicy Bypass -File %updater_script%
)

:: After update, updater.ps1 should not in same folder as mpv.exe
if exist "%~dp0\installer\updater.ps1" if exist "%~dp0\updater.ps1" (
Expand Down

0 comments on commit d4eac50

Please sign in to comment.