![]() ![]() & %_AppDir_%timeout.exe /t -1 & endlocal & goto=:EOF %_AppDir_%cscript.exe "%temp%\getadmin.vbs"|find/v "." & echo\nul del /q /f "%temp%\getadmin.vbs" & goto=:EOFĬd /d "%~dp0" & set "_Reg_Key=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" Reg Add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%CD%\mha2.exe" /t REG_SZ /d "WIN98 256COLOR 640X480" off & Setlocal EnableDelayedExpansionĢ>nul "%_APPDIR_%whoami.exe" /groups | find "S-1-16-12288" >nul & goto=:gotAdminĮcho\Requesting administrative privileges. REM # -> If error flag set, we do not have admin.Įcho "Requesting administrative privileges."Įcho Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"Įcho UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 > "%temp%\getadmin.vbs" >nul 2>&1 "%SystemRoot%\system32\cacls.exe" "%SystemRoot%\system32\config\system" ![]() >nul 2>&1 "%SystemRoot%\SysWOW64\cacls.exe" "%SystemRoot%\SysWOW64\config\system" If "%PROCESSOR_ARCHITECTURE%" EQU "amd64" ( In case somebody wants to do the same off. ![]() After a few hours of work, I figured it out: Admin privileges are required to start the script when including a one-liner before Reg Add, as cmd will start it in %WinDir%\system32. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |