How to open PowerShell as an administrator on Windows 11
Running PowerShell with elevated or administrator-level permissions allows you to run commands that bypass Windows file protection, such as those used for Windows installation files.
You can run PowerShell by opening PowerShell directly or by opening the new Windows Terminal application, which uses PowerShell to run commands by default.
Open PowerShell as administrator on Windows 11:
- Open the Start menu and enterpowershellorterminal.
- SelectRun as administrator from the results list on the right.
![如何在 Windows 11 上以管理员身份打开 PowerShell](https://img.php.cn/upload/article/000/000/164/168371520928078.png)
- When the PowerShell Terminal opens, you'll know it's running with elevated privileges because it will displayAdministratorin the title bar.
![如何在 Windows 11 上以管理员身份打开 PowerShell](https://img.php.cn/upload/article/000/000/164/168371520966147.png)
How to update Terminal to always run as administrator
If you always want PowerShell to run with administrator-level permissions, you can set upWindows Terminal(PowerShell is used by default) to do this.
Always run Terminal as administrator on Windows 11:
- First, check your Windows Terminal version by typing the following command and pressingEnter:
- A small screen will open showing your terminal version.
![如何在 Windows 11 上以管理员身份打开 PowerShell](https://img.php.cn/upload/article/000/000/164/168371520973564.png)
- You need to update your Windows Terminal version to the latest version, so type the following to do so:
Winget install –id Microsoft.WindowsTerminal.Preview
Copy after login
- The update will take a while, you will need to enterYto agree to the terms and pressEnter.
![如何在 Windows 11 上以管理员身份打开 PowerShell](https://img.php.cn/upload/article/000/000/164/168371521018778.png)
- The latest version (e.g.13.10733.0) will be successfully installed on your system.
![如何在 Windows 11 上以管理员身份打开 PowerShell](https://img.php.cn/upload/article/000/000/164/168371521094335.png)
- Next, right-click on the Start menu and selectWindows Terminal.
![如何在 Windows 11 上以管理员身份打开 PowerShell](https://img.php.cn/upload/article/000/000/164/168371521086404.png)
- In theTerminalwindow, press thedown arrow next to the New Tab button and selectSettings.
![如何在 Windows 11 上以管理员身份打开 PowerShell](https://img.php.cn/upload/article/000/000/164/168371521085329.png)
- In theSettingssection, under "Profile", click "Windows PowerShell".
- Toggle theRun this profile as administratorswitch and clickSave.
![如何在 Windows 11 上以管理员身份打开 PowerShell](https://img.php.cn/upload/article/000/000/164/168371521074553.png)
Running PowerShell commands on Windows 11
Using the above steps, you will be able to run PowerShell as an administrator on Windows 11. This will allow you to run powerful commands to help change settings or troubleshoot issues with Windows 11.
The above is the detailed content of How to open PowerShell as administrator on Windows 11. For more information, please follow other related articles on the PHP Chinese website!