Windows 10

Add PowerShell to Windows Explorer Context Menu in Windows 10

Ever since the days of Windows Vista, it was possible to use Windows Explorer’s context menu to quickly open a command prompt window to a specific location by holding the shift key and right-clicking a folder. The “Open Command Prompt Here” appeared, allowing you to open the command prompt in the folder of your choice.

However, this option only worked for the command prompt, and as we all know, PowerShell is the preferred command-line application in Windows operating systems since the last seven or eight years. So why not add it to the Windows Explorer context menu as well?

If you find that you frequently open a PowerShell window and change to a specific directory, you can add the “Open PowerShell Here” option to your Windows Explorer context menu. This option enables you to right click on a folder within Windows Explorer, and choose it, which opens a PowerShell window with that folder as your active directory.

To add the “Open PowerShell Here” option to the default right click context menu in Windows Explorer, perform the following steps:

Sponsored Content

What is “Inside Microsoft Teams”?

“Inside Microsoft Teams” is a webcast series, now in Season 4 for IT pros hosted by Microsoft Product Manager, Stephen Rose. Stephen & his guests comprised of customers, partners, and real-world experts share best practices of planning, deploying, adopting, managing, and securing Teams. You can watch any episode at your convenience, find resources, blogs, reviews of accessories certified for Teams, bonus clips, and information regarding upcoming live broadcasts.

Before proceeding, please read carefully:

Warning: This document contains instructions for editing the registry. If you make any errors while editing the registry, you can potentially cause Windows to fail or be unable to boot, requiring you to reinstall Windows. Edit the registry at your own risk. Always back up the registry before making any changes. If you do not feel comfortable editing the registry, do not attempt these instructions. Instead, seek the help of a trained computer specialist.

1. Open the Registry Editor. You can do this by clicking on Start and typing regedit.

Opening the Registry Editor. (Image Credit: Daniel Petri)
Opening the Registry Editor. (Image Credit: Daniel Petri)

If you want, you can also click on the Windows key + R, and type “regedit.” Click “OK.”

Opening the Registry Editor. (Image Credit: Daniel Petri)
Alternative method for opening the Registry Editor. (Image Credit: Daniel Petri)

You may be prompted with a UAC prompt, click “Yes.”

User Account Control prompt. (Image Credit: Daniel Petri)
User Account Control prompt. (Image Credit: Daniel Petri)

2. Navigate to the following path:

HKEY_CLASSES_ROOT\Directory\Shell

3. Create a new key by clicking Edit > New > Key.

Creating a new key in the Registry Editor. (Image Credit: Daniel Petri)
Creating a new key in the Registry Editor. (Image Credit: Daniel Petri)

Call the new key “powershell.”

Naming the new key. (Image Credit: Daniel Petri)
Naming the new key. (Image Credit: Daniel Petri)

3. Modify the default string in the “powershell” key by right-clicking it and selecting “Modify…”

Modifying the newly-created key. (Image Credit: Daniel Petri)
Modifying the newly-created key. (Image Credit: Daniel Petri)

Call the new value “Open PowerShell Here.” Click “OK.

Editing the string. (Image Credit: Daniel Petri)
Editing the string. (Image Credit: Daniel Petri)
The edited string. (Image Credit: Daniel Petri)
The edited string. (Image Credit: Daniel Petri)

4. In the powershell key, create a new key by clicking Edit > New > Key.

add-ps-context-menu-9

Call the new key “command.”

add-ps-context-menu-10

6. Modify the default string in the command key by using the following text:

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command Set-Location -LiteralPath ‘%L’

add-ps-context-menu-11

Click “OK.”

7. Add a new string by clicking Edit > New > String value.

add-ps-context-menu-12

Let’s call it “Icon.”

add-ps-context-menu-13

8. Modify the value by using the following text:

“C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”,0

Click “OK.”

add-ps-context-menu-14

9. This is how it’s supposed to look once you’re done.

add-ps-context-menu-15

After completing these steps, close the registry, and open Windows Explorer. Go to any folder of your choice and right-click the folder:

add-ps-context-menu-16

add-ps-context-menu-17

Related Topics:

BECOME A PETRI MEMBER:

Don't have a login but want to join the conversation? Sign up for a Petri Account

Register
Comments (0)

Leave a Reply

External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by:

 
Office 365 Coexistence for Mergers & Acquisitions: Don’t Panic! Make it SimpleLive Webinar on Tuesday, November 16, 2021 @ 1 pm ET

In this session, Microsoft MVPs Steve Goodman and Mike Weaver, and tenant migration expert Rich Dean, will cover the four most common steps toward Office 365 coexistence and explain the simplest route to project success.

  • Directory Sync/GAL Sync – How to prepare for access and awareness
  • Calendar Sharing – How to retrieve a user’s shared calendar, or a room’s free time
  • Email Routing – How to guarantee email is routed to the active mailbox before and after migration
  • Domain Sharing – How to accommodate both original and new SMTP domains at every stage

Aimed at IT Admins, Infrastructure Engineers and Project Managers, this session outlines both technical and project management considerations – giving you a great head start when faced with a tenant migration.the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

Sponsored by: