Batch start the software as an administrator

Batch start software

@echo off
"C:\Program Files (x86)\Tencent\QQ\Bin\QQScLauncher.exe"
"D:\Program Files (x86)\Tencent\WeChat\WeChat.exe"
exit

 

 

 

Use the wording of the administrator to start I am here to use vs2008 as an example

@echo off

>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

if '%errorlevel%' NEQ '0' (

goto UACPrompt

) else ( 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" )
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"

Guess you like

Origin blog.csdn.net/qq_41630695/article/details/113802549