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:
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -file mypowerscript.ps1
This is not comfortable. Even worse: its annoying.
Is there really to way to make an execution easier?
I can imagine that there is a solution to automatically (!) pass the double clicked *.ps1 script to Powershell with appended
-NoProfile -ExecutionPolicy Bypass -file
Most probably I have to setup something in Registry
How would that look like on Win 7?
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
You must be logged in to reply to this topic.