batch file - Elevated Privilege in XP -
does know how on xp using tha batch command, tested in limited user. have found , works fine in w7 when tried on xp not work.
cls @echo off :: batchgotadmin :------------------------------------- rem --> check permissions >nul 2>&1 "%systemroot%\system32\cacls.exe" "%systemroot%\system32\config\system" rem --> if error flag set, not have admin. if '%errorlevel%' neq '0' ( cls echo ... restart console privilege admin ... pause>nul goto uacprompt ) else ( echo ... ok jedi ... goto gotadmin ) :uacprompt echo set uac = createobject^("shell.application"^) > "%temp%\getadmin.vbs" echo uac.shellexecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" exit /b :gotadmin if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) pushd "%cd%" cd /d "%~dp0" :--------------------------------------
Comments
Post a Comment