To do so registry tweaks are needed:
First, configure a PSDrive for HKEY_CLASSES_ROOT since this isn’t set up by default. The command for this is:
1 |
New-PSDrive HKCR Registry HKEY_CLASSES_ROOT |
Now you can navigate and edit registry keys and values in HKEY_CLASSES_ROOT just like you would in the regular HKCU and HKLM PSDrives.
To configure double-clicking to launch PowerShell scripts directly:
1 |
Set-ItemProperty HKCR:\Microsoft.PowerShellScript.1\Shell '(Default)' 0 |
To configure double-clicking to open PowerShell scripts in the PowerShell ISE:
1 |
Set-ItemProperty HKCR:\Microsoft.PowerShellScript.1\Shell '(Default)' 'Edit' |
To restore the default value (sets double-click to open PowerShell scripts in Notepad):
1 |
Set-ItemProperty HKCR:\Microsoft.PowerShellScript.1\Shell '(Default)' 'Open' |