Skip to content

Instantly share code, notes, and snippets.

@mzhboy
Created October 15, 2024 14:37
Show Gist options
  • Save mzhboy/bde094e0048c6de302627df22a82ac49 to your computer and use it in GitHub Desktop.
Save mzhboy/bde094e0048c6de302627df22a82ac49 to your computer and use it in GitHub Desktop.
add `powershell5here` to right menu
'Directory',
'Directory\Background',
'Drive' | ForEach-Object {
$Path = "Registry::HKEY_CLASSES_ROOT\$_\shell\PowerShell5Here";
New-Item -Path $Path -Name 'command' -Force | Out-Null;
Set-ItemProperty -Path "$Path\command" -Name '(default)' -Value "${Env:WinDir}\System32\WindowsPowerShell\v1.0\powershell.exe -NoExit -NoLogo -Command ""Set-Location -LiteralPath '%V'""";
Set-ItemProperty -Path $Path -Name '(default)' -Value 'PowerShell5 Here';
Set-ItemProperty -Path $Path -Name 'Icon' -Value "${Env:WinDir}\System32\WindowsPowerShell\v1.0\powershell.exe,0";
}
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\directory\shell\PowerShell5Here]
@="PowerShell5 Here"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe,0"
[HKEY_CLASSES_ROOT\directory\shell\PowerShell5Here\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -NoLogo -Command \"Set-Location -LiteralPath '%V'\""
[HKEY_CLASSES_ROOT\directory\background\shell\PowerShell5Here]
@="PowerShell5 Here"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe,0"
[HKEY_CLASSES_ROOT\directory\background\shell\PowerShell5Here\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -NoLogo -Command \"Set-Location -LiteralPath '%V'\""
[HKEY_CLASSES_ROOT\Drive\shell\PowerShell5Here]
@="PowerShell5 Here"
"Icon"="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe,0"
[HKEY_CLASSES_ROOT\Drive\shell\PowerShell5Here\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -NoLogo -Command \"Set-Location -LiteralPath '%V'\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment