Why PS2 opens in notepad and not PS1?
by vgandhi at 2012-12-04 13:33:39
We have written a few powershell PS1 scripts and all work fine.
Now, we are on our way to migrate all of them to PS2 and having trouble in executing new ones.
When I execute command ./my_script.ps1, it does execute it with no trouble, but ps2 script opens up in notepad by itself for some reason.
What could be the reason for this? Can some one please help me in resolving this?
by jaberkenbile at 2012-12-04 15:00:47
vgandhi: Are your script files using a .ps2 extension?
If so they need to have a .ps1 extension.
All versions of PowerShell use .ps1 as the file extension for scripts.
by RichardSiddaway at 2012-12-05 01:47:48
By default powershell files – including scripts with a .ps1 extension – will open in notepad if you double click them or right click and select open. This is by design to reduce the cahnces of inadvertantly running a script & remove some of the scenarios in which maicious scripts could be run without your knowledge
You must be logged in to reply to this topic.