How to Open PowerShell in a Folder in Windows Explorer

choubertsprojects

The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

The Windows Command Prompt is a part of the Microsoft Windows operating system, and it allows users to enter commands and execute them in order to perform various tasks.
There are two ways that you can open PowerShell in a folder: using the Run button or by typing cmd into Search box. The first way involves clicking on the run button, which opens up an application window where you type your command(s). In contrast, typing cmd into search will bring up all results related to “cmd.” This includes windows folders with no text files but only executables present as well as any text documents created within these applications.

The “how to open powershell in a folder as administrator windows 11” is the process of opening PowerShell in a folder that you have access to. To do this, you will need to be an administrator and have the proper permissions.

How to Open PowerShell in a Folder in Windows Explorer

Have you ever needed to quickly start a PowerShell prompt in a folder in Windows File Explorer? Are you looking for an option to open a powershell window or a command window? If that’s the case, you’re in luck. In this article, you’ll learn how to use Windows file explorer to open PowerShell in a specified folder.

Prerequisites

If you want to follow along, you’ll need the following items:

  • A computer that runs Windows 10, Windows Server 2016, or Windows Server 2019. Windows 10 will be used in this lesson.
  • Using a local account that belongs to the Administrators group, or at the very least, with the ability to elevate to administrator if required.

Using the Address Bar to launch PowerShell

At the top of File Explorer’s window is an area that enables you to launch applications as if you were at a command prompt. By hitting CTRL, you may launch PowerShell from this address bar. From File Explorer, go to:

  1. Hold down the ALT or CTRL key.
  2. D or L are the keys to use. The cursor is now in the address bar.
  3. Press Enter after typing powershell. The current directory will be used to launch PowerShell.

You will be at an administrative prompt for both PowerShell and Command Prompt if you are signed in as the Administrator.

What you should see on your screen is the animated animation below:

To open a PowerShell window, use ALT+D.To open a PowerShell window, use ALT+D.

The file menu is another convenient option to launch PowerShell in File Explorer. You may use the mouse or keyboard shortcut to access the file menu. The file menu may be accessed by pressing ALT. In File Explorer, go to:

  1. Keep the ALT key pressed and held.
  2. F is the function key. The file menu will be shown as a result of this action.
  3. Toggle the S key. This choice will open a new sub-menu and choose Open Windows PowerShell.
  4. Last but not least, hit the R key. The current directory will be used to launch PowerShell.

Instead of using R, use A to launch PowerShell as an administrator.

How to Run PowerShell as an Administrator is a related topic.

The animated gif below depicts how the procedure should be carried out:

To launch a standard PowerShell window in the current directory, press ALT+F+S+R.To launch a standard PowerShell window in the current directory, press ALT+F+S+R.

While exploring the context menu with the ALT key pressed, keys to hop across menus will appear. Windows 10, Windows Server 2016, and Windows Server 2019 all support the shortcut keys.

Now that you’ve memorized all of the shortcut keys, it’s time to go a bit further and create a context menu in File Explorer.

When you right-click on an object in Windows, you’ll notice a context menu appear.

You may construct a custom context menu item to rapidly start a PowerShell window when you right click within a folder by using a specifically placed Windows registry value. Let’s make a difference.

When you right-click a folder in File Explorer, you’ll see that there is no option to launch PowerShell in the context menu.

PowerShell does not have a context menu item.PowerShell does not have a context menu item.

If you hold down the SHIFT key when right-clicking on a folder, you’ll see the context menu item below.

When using SHIFT+Right-Click, there is a context menu option.When using SHIFT+Right-Click, there is a context menu option.

Let’s create a custom context menu option that lets you launch a PowerShell window without having to hold down the Shift key.

You’ll need to generate a few different Windows registry entries and values to make a custom context menu item. When these variables are set, a custom context menu item is produced immediately.

The relevant Windows registry keys and values are listed below:

Path Name Value Notes
HKCR:Directoryshellpowershellmenu (Default) Open PowerShell from this location.  
HKCR:Directoryshellpowershellmenucommand (Default) -NoExit -Command Set-Location -LiteralPath’percent L’ C:Windowssystem32WindowsPowerShellv1.0powershell.exe -NoExit -Command Set-Location -LiteralPath’percent L’  
HKCR:Directoryshellrunas (Default) Open PowerShell from this location. as Administrator  
HKCR:Directoryshellrunas HasLUAShield   This includes a symbol for increased prompts.

You may manually generate the aforementioned keys and values to add the custom context menu, or you can use a PowerShell script to perform the hard work for you.

You may use the script below to rapidly build all of the required keys and values in one go.

$Menu = ‘Open PowerShell from this location.’ $Command = “C:Windowssystem32WindowsPowerShellv1.0powershell.exe -NoExit -Command Set-Location -LiteralPath ‘%L’” $RunAsMenu = ‘Open PowerShell from this location. as Administrator’ HKCR doesn’t exist by defualt in PSDrives, so you need to create it. New-PSDrive -PSProvider Registry -Root HKEY_CLASSES_ROOT -Name HKCR Now create the keys and values (non-admin) New-Item -Path HKCR:Directoryshell -Name ‘powershellmenu’ -Force | Set-ItemProperty -Name ‘(Default)’ -Value $Menu New-Item -Path HKCR:Directoryshellpowershellmenucommand -Force | Set-ItemProperty -Name ‘(Default)’ -Value $Command Now create the keys and values (admin) New-Item -Path HKCR:Directoryshell -Name ‘runas’ -Force | Set-ItemProperty -Name ‘(Default)’ -Value $RunAsMenu # This includes a symbol for increased prompts. New-ItemProperty -Path HKCR:Directoryshellrunas -Name HasLUAShield -Value ” New-Item -Path HKCR:Directoryshellrunascommand -Force | Set-ItemProperty -Name ‘(Default)’ -Value $Command

When you’re done generating the registry keys and values, you should see something like this:

Complete context menu registry key entry for Open PowerShell from this location. option.Complete context menu registry key entry for Open PowerShell from this location. option.

Once complete, close the Windows registry editor if you have it open and right click on any folder within File Explorer. You should now see the new Open PowerShell from this location. context menu entry you created!

Open PowerShell from this location. context menuOpen PowerShell from this location. context menu

Below is the new context menu Open PowerShell from this location. option in action:

Context menu Open PowerShell from this location. option in action.Context menu Open PowerShell from this location. option in action.

Steps to Follow

What else can you add to your context menus to boost your file explorer productivity now that you know how to start a PowerShell window from inside File Explorer? You may try adding a Launch Command Prompt Here option or experimenting with context menus to open various PowerShell profiles. Even better, add an icon to the context menu!

“Open powershell from file explorer” is a command that allows users to open the PowerShell in Windows Explorer. Reference: open powershell from file explorer.

Frequently Asked Questions

How do I open a PowerShell folder in Explorer?

A: Explorer is not able to open PowerShell folders automatically, if you want to access it in Windows 7 or earlier then open up the start menu and type convert exe which will bring up command prompt with a file explorer window that opens into your current folder. You can also use an app like FileZilla which allows FTP/SFTP access to your remote host (which powershell would be on).

How do I run a PowerShell script from a folder?

A: Open Powershell as an Administrator. Right-click the folder you want to run from and select Open PowerShell window here.

How do I open PowerShell in a specific location Windows 10?

A: To open PowerShell in a specific location, you will first have to get access to it. Lets say that the path is C:\Windows\System32\. In order for this command to work, there has been an installation process where the user was given administrator rights and therefore able do so.

Related Tags

  • how to open powershell in a folder windows 10
  • how to open powershell in a folder windows 7
  • how to open powershell in cmd
  • open powershell in folder shortcut
  • open powershell window here windows 10

Table of Content