If you’re not careful about naming your scripts then it’s often helpful to be able to ‘preview’ them from within (File) Explorer rather than have to open them in an editor.
Here’s a QAD (Quick and Dirty) method of adding a Preview handler for different script types:
1. Open the Registry Editor (using Run as administrator).
2. Navigate (for example) to HKEY_CLASSES_ROOT\.ps1 and select it in the left-hand navigation pane.
3. In the right-hand pane, right-click and choose the option New > String value.
4. Rename the New Value #1 entry to PerceivedType.
5. Modify the entry’s Data value to text.
That’s it.
To test, navigate within (File) Explorer and select a PowerShell .ps1 file. Use ALT+p to turn on the Preview pane.
I’ve added preview handlers for .PS1, .AHK and .VBS files in both Win 10 and Win 7 so far (as these are all that I normally use).
Note: I found that I couldn’t just import a REG file with the settings, either by double-clicking on a REG file or even running REGEDIT as Administrator and importing the REG file. I saw all the ‘normal’ prompts and messages that the import was successful… but nothing changed in the registry. The manual method is so quick that I haven’t (yet) looked into whether I can script the addition of the required entry.
Hope this helps…