In the article “11 Must-Have Apps for Windows 11” I talked about how much I love Windows 11 despite its few shortcomings. One of those is particularly annoying for IT folks like you and me. There’s no way of launching PowerShell or rather Windows Terminal as Administrator directly from File Explorer.
While looking for a plausible solution, I stumbled upon a Windows App called Custom Context Menu. Despite the app being listed for $1, there’s an unlimited free trial. But please consider buying the app if you want to support the Dev.
This app allows you to create your own modern context menu entries for specific file types or folders. These are the settings which you need to add in order to add “Open in Windows Terminal (Admin)” to your Windows 11 Context Menu.
Choose C:\Windows\System32\cmd.exe
as your executable and use the following code as your Param. As with any syntax, the exact order and number of double quotes is extremely important here. It took me quite a few tries to get it right.
|
|
Enter a path for whatever icon you want under Icon and only toggle the Match Folder switch.
Alternatively, you can also click on the folder icon located in the top left corner and just create a new JSON file with the following content.
|
|
If you like, you can give your context menu entry a custom name by clicking the gear icon in the bottom right corner.
Click save and either restart explorer.exe or your PC. This is very important as the menu won’t load without a restart.
How It Looks and Behaves
When you right click in any folder, you should see your custom context menu and choose “Open in Windows Terminal (Admin)” or whatever name you entered.
Make sure that you’ve set the Starting directory of the PowerShell Profile in Windows Terminal to “Use parent process directory”. Otherwise, Windows Terminal will not start in the current folder where you right clicked in Explorer.
Adding More Entries
If you also want to add “Open in VS Code” to the modern context menu in Windows 11, you can add a second entry using the following code or configuration.
|
|
I hope that the option to launch Windows Terminal as admin or any other app really, also helps you be more productive. Initially, I discovered this app because I was looking for an easy way to bulk convert HEIC or HEIF images to JPG. Once I realized the potential of this App, I just had to figure out the correct params to launch WT as admin. I will definitely write another blog post about how to convert HEIC images to JPG using the same app and ImageMagick CLI.