How to Open Powershell With Admin Privileges From CMD


    Windows 10 and 11 logos

    PowerShell and Command Prompt (CMD) have a lot of overlapping functionality, but what if you specifically need to open PowerShell from Command Prompt or a batch file? Here’s how you do it.

    How to Open PowerShell From Administrator CMD

    When you run any application from an elevated Command Prompt, that application also starts with administrative privileges. The same applies to batch files — if the script was run as administrator, then any applications started by the script will also be run as administrator. Type powershellinto Command Prompt to start PowerShell with admin privileges.

    Note: On Windows 10, running powershell in Command Prompt will open a new PowerShell window. If you’re using Windows 11, it’ll behave a bit differently. Command Prompt launches in Windows Terminal, and when you run PowerShell from Command Prompt, it just runs it within the same window.

    How to Open PowerShell From Any CMD

    Starting PowerShell with administrative privileges from a regular, non-elevated Command Prompt window is a pretty roundabout way of doing things. You actually need to invoke PowerShell from Command Prompt to launch a different PowerShell window.

    To do so, type or paste powershell start-process powershell -verb runas into Command Prompt, and then hit Enter. A new elevated PowerShell window will appear.

    As always, be careful doing things in an elevated PowerShell environment. You may want to read more about some of the advanced features PowerShell has to offer.






    Source link

    Previous articleWhat do the Short-Term Technicals Predict for Halving Token (HALV) Sunday?
    Next articleUkraine to launch NFT to mark history of Russian invasion | Ukraine