Is there a way to run/start cmd as administrator through the command line or a batch file programming in Windows 8?
I want to create a batch file which has administrative privileges without any prompt to the user.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
runas /profile /user:administrator “Driver:\folder\program”
For example, the administrator account is “AAA” and you want to run BBB.exe of C:\programs, you should follow these steps:
Hope it works.
You can use
runas.exe /savecred /user:administrator cmdor refer this link
REM --> Check for permissions >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" REM --> If error flag set, we do not have admin. if '%errorlevel%' NEQ '0' ( echo Requesting administrative privileges... 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" ) pushd "%CD%" CD /D "%~dp0"