If I have a PowerShell script named myscript.ps1
and it sits in the PATH, I'd like to be able to press Windows + r, type "myscript", and press enter. Currently it requires me to type myscript.ps1
, and it runs fine.
I've found a few answers that suggested ftype
, assoc
, and the PATHEXT
environment variable, but that only affects scripts run from command prompt or PowerShell, not from explore.exe's Run prompt.
I assume there's some registry setting, but I don't know what to search for, as fileext
has hundreds of entries. I also searched for .bat
since batch files work automatically, but I haven't found anything obvious.
I thought I'd found it under under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\KindMap
by adding a .ps1 value and setting it to program
as .bat, .cmd, .com, and .exe all are set that way, but no dice (even after restarting my computer).
I also noticed that .bat, .cmd, .exe, .lnk, and .msi each had an HKCR\<app-handler-id>\shellex\PropertySheetHandlers\ShimLayer Property Page
set to {513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}
, but adding that to HKCR\Microsoft.Powershell.1
didn't worth either.