windows 如何从运行窗口以管理员身份打开 PowerShell
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32341507/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How open PowerShell as administrator from the run window
提问by mukade
Is possible open a new PowerShell console as administrator through the run window, in Windows?
是否可以在 Windows 中通过运行窗口以管理员身份打开一个新的 PowerShell 控制台?
I know that just typing 'powershell' in the run window is enough to start a new console, but is there a parameter to start it 'as Administrator'?
我知道只需在运行窗口中输入“powershell”就足以启动一个新的控制台,但是是否有一个参数可以“以管理员身份”启动它?
Like:
喜欢:
"powershell /runas:Administrator"
or something?
或者其他的东西?
PS: I'm using Windows 10 -- I don't know if makes any difference.
PS:我使用的是 Windows 10——我不知道是否有什么不同。
回答by Simon M?Kenzie
The easiest way to open an admin Powershell window in Windows 10 (and Windows 8) is to add a "Windows Powershell (Admin)" option to the "Power User Menu". Once this is done, you can open an admin powershell window via Win+X,Aor by right-clicking on the start button and selecting "Windows Powershell (Admin)":
在 Windows 10(和 Windows 8)中打开管理 Powershell 窗口的最简单方法是将“Windows Powershell(管理员)”选项添加到“高级用户菜单”。一旦做到这一点,你可以通过打开管理PowerShell窗口Win+ X,A或通过在开始按钮并选择“的Windows PowerShell(管理)”右键点击:
[
[
Here's where you replace the "Command Prompt" option with a "Windows Powershell" option:
在这里,您可以将“命令提示符”选项替换为“Windows Powershell”选项:
[
[
回答by Matt Wilkinson
Yes, it is possible to run PowerShell through the run window. However, it would be burdensome and you will need to enter in the password for computer. This is similar to how you will need to set up when you run cmd:
是的,可以通过运行窗口运行 PowerShell。但是,这会很麻烦,您需要输入计算机的密码。这类似于您在运行 cmd 时需要进行的设置:
runas /user:(ComputerName)\(local admin) powershell.exe
So a basic example would be:
所以一个基本的例子是:
runas /user:MyLaptop\[email protected] powershell.exe
You can find more information on this subject in Runas.
您可以在Runas 中找到有关此主题的更多信息。
However, you could also do one more thing :
但是,您还可以再做一件事:
- 1: `Windows+R`
- 2: type: `powershell`
- 3: type: `Start-Process powershell -verb runAs`
- 1:`Windows+R`
- 2:类型:`powershell`
- 3:输入:`Start-Process powershell -verb runAs`
then your system will execute the elevated powershell.
那么您的系统将执行提升的 powershell。
回答by Greg Burghardt
Windows 10 appears to have a keyboard shortcut. According to How to open elevated command prompt in Windows 10you can press ctrl + shift + enter from the search or start menu after typing cmd
for the search term.
Windows 10 似乎有一个键盘快捷键。根据如何在 Windows 10 中打开提升的命令提示符,您可以在键入cmd
搜索词后从搜索或开始菜单中按 ctrl + shift + enter 。
(source: winaero.com)
(来源:winaero.com)