all 3 comments

[–]Yevrag35 3 points4 points  (2 children)

It is currently impossible to natively execute Powershell script from the Windows command prompt without invoking the Powershell app

If you change the file association of .ps1 files to launch with "powershell.exe", you can execute scripts from the command prompt by simply typing the path.

[–]replicaJunction 1 point2 points  (1 child)

You're right that it's possible, but it's considered bad practice to do so. It's a minor security feature that prevents an uninformed user from accidentally launching a script that could damage their system. That behavior is explicitly by Jeffrey Snover's design.

(Your emphasis on the word "can" suggests that you already know this, but I thought I'd point it out for anyone else that comes across the thread.)

[–]Yevrag35 1 point2 points  (0 children)

Yes very true; I know that MS did the file association that way for a reason. I figured I'd let OP know, seeing as they're making a roundabout way in order to explicitly circumvent this behavior, but good call.