2

I prefer working with a keyboard and opening context menus using shortcuts. In Windows 11, I can open the context menu with Shift+F10. However, I'd also like to select a menu item using a shortcut. It seems that shortcut keys are displayed for the majority of menu items, except for the one I use the most:

enter image description here

How can I add option to select "Run with PowerShell" with some key press?

3
  • Not sure about native Windows explorer.exe but I think one of the AHK showcase scripts could potentially work for you? I'll see if I can dig it up.
    – Arctiic
    Commented Feb 9 at 11:56
  • 1
    Windows 11 does not natively offer what you want, so you will need to take your chances with 3rd party offerings. I just type a few characters in the Start Search section and get what I want.
    – anon
    Commented Feb 9 at 12:59
  • As @John states, for a submenu (e.g., Send To >), typing a letter or two selects an item. In the main context menu, the up and down keys navigate, and Enter selects. Commented Feb 9 at 17:17

1 Answer 1

3

Open regedit, select Computer in tree, press Ctrl+F to get search box, tick all 4 values, search for "Run with PowerShell"

Once you locate it add "&" in front of letter you wish to use for keybind. So if you want letter P, you should change "Run with PowerShell" to "Run with &PowerShell";

enter image description here

For letter T, set as "Run wi&th PowerShell", T2 means i'll have to press T two times to select it... enter image description here



Remediation attempt

Just an annoying thing is that "&" disappears from time to time, and I need to reset it.

Save as nameit.ps1;

$currentSID = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
$rootPath = "Registry::HKEY_USERS\$currentSID\Software\Classes\Local Settings\MuiCache"
$foundItems = Get-ChildItem -Path $rootPath -Recurse | ForEach-Object {
    $keyPath = $_.PSPath
    $values = Get-ItemProperty -Path $keyPath

    foreach ($valueName in $values.PSObject.Properties.Name) {
        $value = $values.$valueName

        if ($value -eq "Run with PowerShell") {
            $keyPath
            Set-ItemProperty -Path $keyPath -Name $valueName -Value "Run with &PowerShell"
            Write-Output "Registry value replaced in $keyPath" #remove this line if running as script
        }
    }
}

if (-not $foundItems) { #remove statement if running as script
    Write-Output "Registry value not found."
}
2
  • Great, that's exactly what I needed! Thank you very much. Just an annoying thing is that "&" disappears from time to time, and I need to reset it.
    – Kazys
    Commented Mar 19 at 11:20
  • Ha, didnt notice this,...seems windows loves to shuffle its bags :D - This can be further expanded, for example, in combination with Task Scheduler, you can set that path(once found) as one of Environment variable(make yourown), then call Task Scheduler(make script) to check that path if its "anything from what you want", then do whatever next.
    – Danijel
    Commented Apr 24 at 0:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .