Using powershell start CMD as admin and run a command
- User
Using powershell start CMD as admin and run a command
- Assistant
To start Command Prompt (CMD) as an administrator and run a command using PowerShell, you can use the following steps:
-
Open PowerShell with administrative privileges, either by right-clicking on the Start Menu and selecting "Windows PowerShell (Admin)" or searching for "PowerShell," right-clicking on it, and choosing "Run as administrator."
-
In the PowerShell window, you can use the
Start-Processcmdlet to start CMD as an administrator and specify the command you want to run.The syntax for starting CMD as an administrator and running a command is as follows:
codeStart-Process cmd -Verb RunAs -ArgumentList "/c your_command"Replace
your_commandwith the actual command you want to run within CMD.Example: To run the
ipconfigcommand as an administrator in CMD, you can use the following command:code
-