I've been using Powershell a bit lately and finally got to the point where I'm using it so much I want to be able to simply double click on a *.ps1 script file and have Powershell execute it. So, in the interest of creating an internet based reference that I can Google myself when I forget this:
*** Note: Always backup your registry before editing it unless you really like rebuilding things ***
Basically you need to create a default value inside the registry key (if the sequence of keys doesn't exist, create them):
HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\Open\Command
Leave the value with the name '(Default)', make it of type REG_SZ, and set the data to:
Where "
The sequence "& '%1' " is important.
BTW, I highly recommend that you make sure your Powershell script execution settings are set to require remote scripts to be signed properly.
Monday, November 7, 2011
Associating execution of Powershell scripts with the default open action in Windows 7
Posted by Hans 0 comments
Labels: Powershell, registry
Subscribe to:
Posts (Atom)