Open Powershell Window Here as Administrator Context Menu
By Timothy Tibbetts |
PowerShell users might find it useful to add "Open Powershell Window Here" to their Context Menu for quick access. Using PowerShell (go figure), this is easy to accomplish.
Back up your registry before proceeding, should you change your mind.
Open PowerShell as Admin by pressing the Windows Key + X.
Copy and paste the following code into PowerShell and press the Enter key:
$menu = 'Open Windows PowerShell Here as Administrator'
$command = "$PSHOMEpowershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""
'directory', 'directorybackground', 'drive' | ForEach-Object {
New-Item -Path "Registry::HKEY_CLASSES_ROOT$_shell" -Name runascommand -Force |
Set-ItemProperty -Name '(default)' -Value $command -PassThru |
Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
Set-ItemProperty -Name HasLUAShield -Value ''
}
While there are many registry files available on the internet to accomplish the same thing, we found this single-step method worked better.
Many guides also forget to mention that you can click on File > Open Windows PowerShell if using File Explorer.
If you change your mind, you can restore from the registry or download ShellExView.
You can also download these instructions and take them with you.
Similar:
How to Delete, Add, and Edit Context Menu Items
How to Fix a Screwed Up Right-Click Context Menu
Add the Control Panel to the Context Menu in Windows 10
Add 'Kill All Not Responding Tasks' Context Men
How to Add File Hash to the Context Menu
How to Restore Missing Pin to Start Context Menu in Windows 10
How to Add Timeline or TaskView to the Windows 10 Context Menu
Remove the "Share" Context Menu in Windows 10
comments powered by Disqus
Back up your registry before proceeding, should you change your mind.
Open PowerShell as Admin by pressing the Windows Key + X.
Copy and paste the following code into PowerShell and press the Enter key:
$menu = 'Open Windows PowerShell Here as Administrator'
$command = "$PSHOMEpowershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""
'directory', 'directorybackground', 'drive' | ForEach-Object {
New-Item -Path "Registry::HKEY_CLASSES_ROOT$_shell" -Name runascommand -Force |
Set-ItemProperty -Name '(default)' -Value $command -PassThru |
Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
Set-ItemProperty -Name HasLUAShield -Value ''
}
While there are many registry files available on the internet to accomplish the same thing, we found this single-step method worked better.
Many guides also forget to mention that you can click on File > Open Windows PowerShell if using File Explorer.
If you change your mind, you can restore from the registry or download ShellExView.
You can also download these instructions and take them with you.
Similar:
How to Delete, Add, and Edit Context Menu Items
How to Fix a Screwed Up Right-Click Context Menu
Add the Control Panel to the Context Menu in Windows 10
Add 'Kill All Not Responding Tasks' Context Men
How to Add File Hash to the Context Menu
How to Restore Missing Pin to Start Context Menu in Windows 10
How to Add Timeline or TaskView to the Windows 10 Context Menu
Remove the "Share" Context Menu in Windows 10
comments powered by Disqus