What is Elevated Command Line ?
The Elevated command Line is using administration rights with command line
I regularly need to access or edit at administration level and have adapted the following command script (saved with .cmd extension) to elevate the command line.
This process opens the User Account Control window which request access to administration rights
@Echo off
REM Open Elevated Command prompt - A Waterhouse 2011
:: Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
:: 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"
:--------------------------------------
cd C:\Windows\System32/
cmd
when attaching usb devices these can cause port allocations and sometimes errors occur for reasons you cannot easily see.
By Running this elevated device manager script, you get the non present (remembered) devices shown,
when you select show hidden devices from the device manager View Tab.
@Echo off
REM Open Device Manager with show no present devices - A Waterhouse 2011
REM Requires Select Show Hidden Devices from Device Manager View tab
:: Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
:: 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"
:--------------------------------------
SET DEVMGR_SHOW_NONPRESENT_DEVICES=1
SET DEVMGR_SHOW_HIDDEN_DEVICES=1
start devmgmt.msc
changing DEVICES to =0 will hide the non present devices.