From d4eac508ce4da9f9c659da3f5ca483284cb4d0fe Mon Sep 17 00:00:00 2001 From: xd003 Date: Thu, 26 Oct 2023 02:25:36 +0530 Subject: [PATCH] Run script using Windows Powershell if available --- mpv-root/updater.bat | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mpv-root/updater.bat b/mpv-root/updater.bat index a6d5046..aebd158 100644 --- a/mpv-root/updater.bat +++ b/mpv-root/updater.bat @@ -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" (