在Windows 10中打开PowerShell的9种方法

本文介绍了在Windows 10中打开PowerShell的九种不同方式,包括从开始菜单、高级用户菜单、搜索框、文件资源管理器、任务管理器、右键单击上下文菜单、创建快捷方式等。PowerShell是一种更强大、功能丰富的命令行工具,适合高级用户和IT专业人员使用。
摘要由CSDN通过智能技术生成
The "Open Windows PowerShell" option in File Explorer.

PowerShell is a more powerful command-line shell and scripting language than Command Prompt. Since the release of Windows 10, it’s become the default choice, and there are many ways you can open it.

与命令提示符相比,PowerShell是一种更强大的命令行外壳和脚本语言。 自Windows 10发布以来,它已成为默认选择,您可以通过多种方式打开它。

PowerShell is more complicated to use, but it’s a much more robust and powerful than Command Prompt. That’s why it’s become the preferred scripting language and command-line interface for Power Users and IT pros, competing favorably with other Linux and Unix-like shells.

PowerShell的使用更加复杂,但是它比命令提示符更加健壮和强大。 这就是为什么它已成为Power Users和IT专业人员首选的脚本语言和命令行界面,并与其他Linux和类似Unix的外壳竞争激烈的原因。

PowerShell is a handy tool that uses cmdlets (pronounced “command-lets”), which allow you to do some pretty cool things like automate Windows or automatically connect to a VPN when you launch specific apps.

PowerShell是使用cmdlet(发音为“ command-lets”)的便捷工具,它使您可以执行一些很酷的事情,例如在启动特定应用程序时自动 执行Windows自动连接到VPN

While you can open PowerShell from the Start menu, this list includes some (potentially) easier and lesser-known ways you can launch this tool.

虽然可以从“开始”菜单打开PowerShell,但是此列表包括一些(可能)更简单且鲜为人知的启动此工具的方法。

从高级用户菜单 (From the Power Users Menu)

The Power Users menu appears in the taskbar when you press Windows+X. It’s an easy way to access a multitude of settings, utilities, and system programs from one menu.

当您按Windows + X时,高级用户菜单出现在任务栏中。 这是一种从一个菜单访问多种设置,实用程序和系统程序的简便方法。

To open PowerShell from this menu, press Windows+X, and then click “Windows PowerShell” or “Windows PowerShell (Admin).”

要从此菜单打开PowerShell,请按Windows + X,然后单击“ Windows PowerShell”或“ Windows PowerShell(Admin)”。

Click "Windows PowerShell" or "Windows PowerShell (Admin)."

Note that since the Creators Update for Windows 10, PowerShell appears in the Power Users menu by default. If you don’t see it, your computer may not be up-to-date, or, perhaps, you replaced it with Command Prompt in the Settings menu.

请注意,自Windows 10的创建者更新以来 PowerShell默认显示在“高级用户”菜单中。 如果看不到它,则说明您的计算机可能不是最新的,或者您可能是在“设置”菜单中将其替换为“命令提示符”。

It’s straightforward to switch back to showing the PowerShell on the menu. Follow our steps here, but toggle-On the “Replace Command Prompt with Windows PowerShell” option, instead.

切换回在菜单上显示PowerShell很简单。 请按照此处的步骤进行操作,但是请启用“使用Windows PowerShell替换命令提示符”选项。

从开始菜单搜索 (From a Start Menu Search)

Probably one of the fastest ways to open PowerShell is via a Start Menu Search. Just click the Start or Search icon, and then type “powershell” in the search box.

打开PowerShell最快的方法之一就是通过“开始”菜单搜索。 只需单击“开始”或“搜索”图标,然后在搜索框中键入“ powershell”。

Click the Search icon and type "powershell" in the text box.

Now, click “Open” or “Run as Administrator” to open PowerShell either normally or with administrative privileges.

现在,单击“打开”或“以管理员身份运行”以正常或具有管理特权打开PowerShell。

Click "Open" or "Run As Administrator."

通过滚动开始菜单中的所有应用程序 (By Scrolling Through All Apps in the Start Menu)

Because PowerShell is a default Windows 10 program, you can find its application icon in the “All Apps” section of the Start Menu.

由于PowerShell是默认的Windows 10程序,因此可以在“开始”菜单的“所有应用程序”部分中找到其应用程序图标。

Just click the Start icon, and then click “All Apps” to expand the list of applications installed on your computer.

只需单击“开始”图标,然后单击“所有应用程序”以展开计算机上安装的应用程序列表。

Click the Start icon, and then click "All Apps."

Scroll down, click the “Windows PowerShell” folder, and then select “Windows PowerShell” to open it.

向下滚动,单击“ Windows PowerShell”文件夹,然后选择“ Windows PowerShell”将其打开。

Click the "Windows PowerShell" folder, and then click "Windows PowerShell."

To run PowerShell with admin privileges, right click the icon, and then click “Run as Administrator” in the context menu that appears.

要以管理员权限运行PowerShell,请右键单击该图标,然后在出现的上下文菜单中单击“以管理员身份运行”。

Right-click "Windows PowerShell," and then click "Run as Administrator."

从运行框 (From the Run Box)

Press Windows+R to open the Run dialog box, and then type “powershell” in the text box. You can either click “OK” (or press the Enter) to open a regular PowerShell window, or press Ctrl+Shift+Enter to open an elevated PowerShell window.

按Windows + R打开“运行”对话框,然后在文本框中键入“ powershell”。 您可以单击“确定”(或按Enter)打开常规的PowerShell窗口,或按Ctrl + Shift + Enter打开提升的PowerShell窗口。

Type "powershell" in the text box, and then click "OK."

从文件资源管理器的文件菜单 (From the File Explorer File Menu)

If you need to open a PowerShell instance from a specific folder on your computer, you can use File Explorer to initiate it within the currently selected directory.

如果需要从计算机上的特定文件夹打开PowerShell实例,则可以使用文件资源管理器在当前选定的目录中启动它。

To do so, open File Explorer and navigate to the folder from which you want to open a PowerShell window.

为此,请打开“文件资源管理器”并导航到要从中打开PowerShell窗口的文件夹。

Once there, click “File,” hover over “Open Windows PowerShell”, and then select one of the following options:

到达该位置后,单击“文件”,将鼠标悬停在“打开Windows PowerShell”上,然后选择以下选项之一:

  • “Open Windows PowerShell”: This opens a PowerShell window within the current folder with standard permissions.

    “打开Windows PowerShell”:这将使用标准权限在当前文件夹中打开一个PowerShell窗口。

  • “Open Windows PowerShell as Administrator”: This opens a PowerShell window within the current folder with administrator permissions.

    “以管理员身份打开Windows PowerShell”:具有管理员权限的当前文件夹中将打开一个PowerShell窗口。

Click "File," hover over "Open Windows PowerShell," and then click your preferred option.

Note that this method doesn’t work from the “Quick Access” directory. You’ll find the option to open PowerShell grayed out when you click “File.”

请注意,该方法不适用于“快速访问”目录。 单击“文件”后,您会发现打开PowerShell的选项呈灰色。

从文件资源管理器地址栏中 (From the File Explorer Address Bar)

To open PowerShell from the File Explorer address bar, open File Explorer. Click the address bar, type “powershell”, and then press Enter.

要从文件资源管理器地址栏中打开PowerShell,请打开文件资源管理器。 单击地址栏,键入“ powershell”,然后按Enter。

Type "powershell" in the File Explorer address bar.

PowerShell will open with the path of the current folder already set.

PowerShell将打开,并已设置当前文件夹的路径。

A PowerShell window.

从任务管理器 (From Task Manager)

To open Task Manager, press Ctrl+Shift+Esc. In the window that appears, click “More details”.

要打开任务管理器,请按Ctrl + Shift + Esc。 在出现的窗口中,单击“更多详细信息”。

Click "More details."

Now, click File > Run New Task.

现在,单击文件>运行新任务。

Click "File," and then click "Run New Task."

Type “powershell” in the text box, and then click “OK” to continue.

在文本框中键入“ powershell”,然后单击“确定”继续。

Type "powershell" in the text box, and then click "OK."

If you want to run PowerShell with administrator permissions, make sure the “Create This Task with Administrator Privileges” option is selected.

如果要使用管理员权限运行PowerShell,请确保选中“使用管理员权限创建此任务”选项。

从右键单击上下文菜单 (From the Right-Click Context Menu)

Another way you can open Windows PowerShell from wherever you are is via the right-click context menu. If you simply right click the folder, though, you won’t see the option. Instead, press Shift as you right click. This opens the context menu and includes the “Open PowerShell Window Here” option.

无论您身在何处,都可以通过右键单击上下文菜单打开Windows PowerShell。 但是,如果只是简单地右键单击该文件夹,则不会看到该选项。 而是在右键单击时按Shift。 这将打开上下文菜单,并包括“此处打开PowerShell窗口”选项。

Click "Open PowerShell Window Here."

You can also permanently add PowerShell to the right-click context menu with this registry hack.

您也可以使用此注册表hack将PowerShell永久添加到右键单击上下文菜单中。

The "Open PowerShell Here" option in the context menu.

在桌面上创建PowerShell快捷方式 (Create a PowerShell Shortcut on the Desktop)

If you’d rather just click an icon to open PowerShell, it’s easy to create one for your Desktop.

如果您只想单击一个图标以打开PowerShell,则很容易为您的桌面创建一个。

To do so, right click an empty spot on the Desktop. In the context menu, click New > Shortcut.

为此,右键单击桌面上的空白处。 在上下文菜单中,单击新建>快捷方式。

Click "New," and then "Shortcut."

In the window that appears, type “powershell” in the text box, and then click “Next” to continue.

在出现的窗口中,在文本框中键入“ powershell”,然后单击“下一步”继续。

Type "powershell" in the text box, and then click "Next."

Name your shortcut, and then click “Finish” to create it.

命名您的快捷方式,然后单击“完成”以创建它。

Type a name for your shortcut in the text box, and then click "Finish."

Now, whenever you double click the icon, PowerShell will open.

现在,只要双击该图标,PowerShell就会打开。

A "Windows PowerShell" window opened from a desktop.

If you want to open PowerShell with administrative privileges, right click the shortcut and choose “Properties” from the context menu.

如果要使用管理权限打开PowerShell,请右键单击快捷方式,然后从上下文菜单中选择“属性”。

Click "Properties."

Click “Advanced”.

点击“高级”。

Click "Advanced."

Finally, select the box next to the “Run as Administrator” option to allow the shortcut to run with the highest privileges.

最后,选择“以管理员身份运行”选项旁边的框,以允许该快捷方式以最高权限运行。

Select the "Run as Administrator" option.

Click “OK” in both windows to save your changes and close the properties windows.

在两个窗口中单击“确定”以保存更改并关闭属性窗口。



Did we forget one? Let us know in the comments below!

我们忘记了吗? 在下面的评论中让我们知道!

翻译自: https://www.howtogeek.com/662611/9-ways-to-open-powershell-in-windows-10/

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值