Possibly save 1 hour of your time:
- Use ./ (dot and slash and PowerShellScriptName) to run the command in the current path folder. You don’t need to enter .ps1
Often times you will type cd to change directory to the folder where the PowerShell script exists. Then you type the script name and it gives you error that the command is not recognized.
PS C:\Scripts> HelloWorld
PS C:\Scripts> ./HelloWorld