diff --git a/set-perms.bat b/set-perms.bat index 5b141cc..f3f1367 100644 --- a/set-perms.bat +++ b/set-perms.bat @@ -1,6 +1,11 @@ @echo off setlocal cd /d "%~dp0" +if "%isTrustedInstaller%" == "1" ( + echo Do not run this script as TrustedInstaller, run it as Administrator. + pause + goto exit +) echo Setting permissions... icacls "%cd%" /setowner Administrators /T /C /L /Q >nul icacls "%cd%" /reset /T /C /L /Q >nul @@ -8,4 +13,5 @@ icacls "%cd%" /inheritance:e /T /C /L /Q >nul icacls "%cd%" /inheritance:r /C /L /Q >nul icacls "%cd%" /setowner Administrators /T /C /L /Q >nul icacls "%cd%" /grant Users:(OI)(CI)RX /grant Administrators:(OI)(CI)F /grant "NT SERVICE\TrustedInstaller":(OI)(CI)F /grant SYSTEM:(OI)(CI)F /T /C /L /Q >nul -pause \ No newline at end of file +pause +:exit \ No newline at end of file diff --git a/ti-shell.bat b/ti-shell.bat index 259691b..87b38d3 100644 --- a/ti-shell.bat +++ b/ti-shell.bat @@ -18,6 +18,7 @@ if not "%~1" == "-ti-run" ( ) endlocal & set "pyexe=%pyexe%" +set "isTrustedInstaller=1" set "pyexe=%pyexe:"=%" set "path=%cd%\path;%path%" set "cmd=%*" diff --git a/unset-perms.bat b/unset-perms.bat index a6e0f37..72e4b17 100644 --- a/unset-perms.bat +++ b/unset-perms.bat @@ -1,6 +1,11 @@ @echo off setlocal cd /d "%~dp0" +if "%isTrustedInstaller%" == "1" ( + echo Do not run this script as TrustedInstaller, run it as Administrator. + pause + goto exit +) echo Setting permissions... icacls "%cd%" /reset /T /C /L /Q >nul pause \ No newline at end of file