Windows PowerShell is a powerful automation tool that has been seamlessly part of the Microsoft operating system since Windows XP. It has many useful and hidden functions that can be easily accessed from the context menu, using the option to open PowerShell here, and change it to the command prompt, much more limited and old. For this, it will be necessary to make some modifications to the Windows registry, as we will see below.
Different ways to access PowerShell
PowerShell is a command line utility which is based on being an improved and advanced version of the traditional Command Prompt. This utility will allow us to execute different command unions, called Scripts, thus facilitating the creation, configuration and automation of multiple tasks.
If we want to access Windows PowerShell we have different ways of doing it available so that it can be a completely personal task.
- Pressing Windows + R to launch the Run command. Once it appears we write powershell and press Enter to confirm. Then it should appear to us. In this case it will open at the user level
- Using the search bar that we have available right next to the Start menu. Here we will write powershell and the application will appear, which we must make sure to check the option to Run as administrator.
- Navigating to the path C: / Windows / system32 / WindowsPowerShell / v1.0 and double-clicking on the powershell.exe file. To run it at the Administrator level, we must right-click on it and choose “Run as administrator”.
- From the advanced user menu. To do this, we must right-click on the Windows icon in the Start menu or use the Windows + X keyboard shortcut. This will show us a menu from which we can select PowerShell or PowerShell (Administrator).
In addition to these forms that are usually the most common, we will also be able to open PowerShell using the context menu of Windows 10. Although it is not a simple or intuitive process, we do have the possibility of doing it by making changes to the registry. In the same way, we can eliminate it in case we do not want it to continue to appear in the context menu.
Add Windows PowerShell to the context menu
As we have commented previously, Microsoft does not make it easy when it comes to having a PowerShell shortcut in the context menu, since it does not have an intuitive and easy way to do it. This will require some modifications to the Windows Registry Editor. This is something that we must do with great care, and only carry it out if we have a certain ease when moving around the editor, since any incorrect changes can affect the stability of the system.
Therefore, to carry out this operation, we begin by accessing the Windows Registry, using the keyboard shortcut “Windows + R” that will allow us to launch the “Execute” command. Here we must write “regedit” and press Enter, which will take us to the editor interface. Once open, we must navigate to the following address.
HKEY_CLASSES_ROOT / Directory / Shell
Create a new PowerShellDesktop key
Once we have navigated to this path, we must right-click on the «Shell» folder. Next, a pop-up menu will appear where we will choose «New» and «Password», to create a new password that we will call PowerShellDesktop.
Later, in the right panel we must double click on the default value to be able to edit its properties. Once this is done, a window appears where we must write Open PowerShell Here in the “value data” field and click on OK.
Create a new key named Command
We go back to the left panel, and right-click on the “PowerShellDesktop” key that we have previously created. This time we are going to select «New» and «Password, assigning it the name of Command. Now we go to the right panel and double click on the value Predetermined to edit its properties. Once the new window is open, we must copy the following string into the value data field
C: / Windows / system32 / WindowsPowerShell / v1.0 / powershell.exe -NoExit -Command Set-Location -LiteralPath ‘%L’
Here we must bear in mind that, if our Windows is not installed on drive C, we must change the path accordingly. Similarly, if we do not have version v1.0 of PowerShell, we must change that number to the version we have. If we want to know the version of PowerShell we have to look at it in the path. In general, unless we have decided to install another version, it is normal that we have v1.0.
C: / Windows / system32 / WindowsPowerShell / v1.0
Once all the data has been entered, click Accept to confirm and the changes should take place immediately. To test it, we just have to right-click on any folder and choose the Windows PowerShell command. Next, the PowerShell window should immediately open and place us inside the selected folder.
Remove Windows PowerShell from the context menu
In the event that we want to remove the Windows PowerShell button from the context menu, we must revert the changes made. To do this, we will use the Windows + R keyboard shortcut to launch the Run command and type regedit to access the Registry Editor. Once inside we navigate to the route:
HKEY_CLASSES_ROOT / Directory / Shell
Here we must right-click on the folder PowerShellDesktop that we had previously created and select «Delete». Once finished we can close the editor and check how Windows PowerShell disappears from the context menu.