I am new to PowerShell scripting. One of the first things I learned is that I (normally !) cannot execute a Powershell script by double clicking on it (similar to *.bat Batch Scripts). Instead I always have to type at command prompt:
Do you really need to run ALL your Powershell scripts by double click? If the answer to this question is "maybe not" – it might be suitable for you to create shortcuts for those ps1 files you like to run by double click. It's really easy. The command line you need is just
powershell -ep bypass -f "Path to your script file"
normally you can just run a script using mypowerscript.ps1 if using the path or ./mypowerscript.ps1 if its in the current directory. if you have to run scripts in the way you describe it sounds like the execution policy may be stopping you
The topic ‘Always automatically execute PowerShell script *.ps1 by double click?’ is closed to new replies.