I am attempting to run a script from the deesktop as a .ps1, the script works perfectly if I copy and paste it into an open powershell or powershell ISE however when I double click the .ps1 file I get the error “the term is not recognized as the name of a cmdlet”
I am not sure where to go from here as I am new to powershell.
There are a few ways to do this. Changing the way the script executes is not ideal as you will get used to that behaviour and it won’t work on any other system unless you make the same changes there.
Put the script into the path so that you can just type the name of the script into the powershell window and it will execute. Handy if it is a reasonably large script.
Add the script to your profile. Handy if the script is small and one you use a lot.
Or get used to having a powershell window open in the directory where your scripts live. Then you just execute it from there.