1

I want know to if there is a command to launch CMD prompt or powershell in elevated privileges from an existing CMD / powershell console. Something along the lines of 'sudo' in *NIX where you don't have to close the console and launch it again.

I have often found myself in situations where in the windows UI I navigate to a folder and want to run CMD/powershell with elevated privileges from over there. Typing CMD in the address bar or Holding Shift + Right Click and choosing 'Open Powershell Here' invokes them in a normal mode and not elevated.

1
2

In PowerShell: This example starts PowerShell by using the Run as administrator option.

Start-Process -Verb RunAs -FilePath "powershell"

Replace powershell with the program you want to run elevated.

1
  • thanks, would you be knowing a similar way for CMD prompt assuming I have the CMD prompt opened?
    – pragun
    Dec 26 '20 at 17:15
0

For Powershell, after you navigate to the specified folder, you can click "File" > select "Open Powershell as administrator". Or just hold Alt and type F>S>A. enter image description here

For CMD, you can first open CMD as administrator, and type cd . Copy your specified folder path to replace . enter image description here

Or you can typr runas /user: Administrator and enter the password. enter image description here

1
  • thanks.got the powershell trick both via File menu and via command..but inside the cmd prompt console - if i run **runas /user: Administrator ** it is asking me for password which I have not set. bypassing it with enter also does not work.
    – pragun
    Dec 26 '20 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.