Skip to content

Commit

Permalink
fix(fileassoc): only do 7zip if it's installed
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Jun 8, 2024
1 parent 3bf577a commit 93ed8d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/playbook/Executables/FILEASSOC.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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%
)
)
Expand Down

0 comments on commit 93ed8d7

Please sign in to comment.