From 93ed8d7262e8633215865c4f04b33da7e2ebd1c5 Mon Sep 17 00:00:00 2001 From: he3als <65787561+he3als@users.noreply.github.com> Date: Sat, 8 Jun 2024 16:14:13 +0100 Subject: [PATCH] fix(fileassoc): only do 7zip if it's installed --- src/playbook/Executables/FILEASSOC.cmd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/playbook/Executables/FILEASSOC.cmd b/src/playbook/Executables/FILEASSOC.cmd index d587ae0c1a..d442d158d4 100644 --- a/src/playbook/Executables/FILEASSOC.cmd +++ b/src/playbook/Executables/FILEASSOC.cmd @@ -36,9 +36,10 @@ if "%~1" == "Brave" set "associations=%baseAssociations% %braveAssociations%" if "%~1" == "LibreWolf" set "associations=%baseAssociations% %libreWolfAssociations%" if "%~1" == "Firefox" set "associations=%baseAssociations% %firefoxAssociations%" if "%~1" == "Google Chrome" set "associations=%baseAssociations% %chromeAssociations%" +if exist "%ProgramFiles%\7-Zip\7zFM.exe" set 7zip=y :: Set 7-Zip assocations -call :7ZIPSYSTEM +if "%7zip%"=="y" call :7ZIPSYSTEM :: Make a temporary renamed PowerShell executable to bypass UCPD :: https://hitco.at/blog/windows-userchoice-protection-driver-ucpd/ @@ -52,7 +53,7 @@ copy /y "%powershellPath%" "%powershellTemp%" > nul for /f "usebackq tokens=2 delims=\" %%a in (`reg query HKU ^| findstr /r /x /c:"HKEY_USERS\\S-.*" /c:"HKEY_USERS\\AME_UserHive_[^_]*"`) do ( reg query "HKU\%%a" | findstr /c:"Volatile Environment" /c:"AME_UserHive_" > nul && ( echo Setting associations for "%%a"... - call :7ZIPUSER "%%a" + if "%7zip%"=="y" call :7ZIPUSER "%%a" "%powershellTemp%" -NoP -NonI -EP Bypass -File ASSOC.ps1 "Placeholder" "%%a" %associations% ) )