From bfd06d953d1cb7e18abbff7702c602ecb32d547d Mon Sep 17 00:00:00 2001 From: Jeffrey <9938813+Raphire@users.noreply.github.com> Date: Sat, 6 Jun 2026 15:51:24 +0200 Subject: [PATCH] Resolve nested quoting bug in Run.bat when path has spaces, see #583 --- Run.bat | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Run.bat b/Run.bat index e4debf5..e47d63e 100644 --- a/Run.bat +++ b/Run.bat @@ -19,15 +19,18 @@ if exist "%wtDefaultPath%" ( set "wtPath=" ) +:: Resolve short (8.3) path for the script to avoid quoting issues with spaces +for %%I in ("%~dp0Win11Debloat.ps1") do set "SCRIPT_SHORT_PATH=%%~fsI" + :: Launch script if defined wtPath ( call :Log Launching Win11Debloat.ps1 with Windows Terminal... - PowerShell -Command "Start-Process -FilePath '%wtPath%' -ArgumentList 'PowerShell -NoProfile -ExecutionPolicy Bypass -File ""%~dp0Win11Debloat.ps1""' -Verb RunAs" >> "%logFile%" || call :Error "PowerShell command failed" + PowerShell -Command "Start-Process -FilePath '%wtPath%' -ArgumentList 'PowerShell -NoProfile -ExecutionPolicy Bypass -File %SCRIPT_SHORT_PATH%' -Verb RunAs" >> "%logFile%" || call :Error "PowerShell command failed" call :Log Script execution passed successfully to Win11Debloat.ps1 ) else ( echo Windows Terminal not found. Using default PowerShell instead... call :Log Windows Terminal not found. Using default PowerShell to launch Win11Debloat.ps1... - PowerShell -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dp0Win11Debloat.ps1""' -Verb RunAs}" >> "%logFile%" || call :Error "PowerShell command failed" + PowerShell -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File %SCRIPT_SHORT_PATH%' -Verb RunAs}" >> "%logFile%" || call :Error "PowerShell command failed" call :Log Script execution passed successfully to Win11Debloat.ps1 )