How it works...
The simplest way to run a PowerShell script is to debug it at the ISE. We use Visual Studio Code as our IDE of choice in this case. The other two ways of calling the script described in this recipe are from the PowerShell console. You may use the integrated console in Visual Studio Code or a PowerShell console called at the Terminal for this purpose.
When the script is located at the present working directory, PowerShell just calls the ps1 file and executes it. Another way of calling PowerShell scripts is to use & (or the call operator): type & followed by a space, followed by the path to the script file. This way of calling handles spaces in the path well.
If the path to the script contains spaces, the path would need to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access