Command to start an application/process elevated as administrator.
Snipped and example Open CMD.exe (DOS Window) asynchronously, in a new window, with current user elevated as administrator and execute basic commands.
*User needs to have granted local Admin rights.
# Misc ::: Start Application as Administrator -_- # PowerShellExamples.com $commandToExecute = "echo Begin & dir & echo End - All Files listed above" Start-Process -Verb RunAs -FilePath cmd.exe -Args '/k', $commandToExecute
Copy code below into a power shell session and execute
# Sample : Misc ::: Start Application as Administrator -_- # PowerShellExamples.com # Open CMD.exe (DOS Window) as administrator and execute commands # Start the process asynchronously, in a new window, # as the current user with elevation (administrative rights). $commandToExecute = "echo Begin & dir & echo End - All Files listed above" # Argument /k leave DOS window open # /c close DOS window after execution Start-Process -Verb RunAs -FilePath cmd.exe -Args '/k', $commandToExecute
==> Open CMD.exe (DOS Window) asynchronously, in a new window, with current user elevated as administrator and execute basic commands.