Scripts
Scripts: A Script Is an Application, Writing Scripts in VS Code, Your First Script, Run It from Anywhere.
Updated
- A Script Is an Application (Novice): Every application takes something in, does some work and gives something back, and a PowerShell script does the same from a .ps1 text file you can read, which makes it a quick-run application of your own, best at jobs made of files, data, settings and other programs.
- Writing Scripts in VS Code (Apprentice): VS Code with Microsoft's free PowerShell extension colors a script, suggests commands as you type, underlines problems such as a missing quote or an alias before you run anything, and runs the whole script with F5 in a terminal inside the editor.
- Your First Script (Apprentice): A script is a .ps1 file of commands that run from top to bottom, with comments starting with # that say what it does, and you run it from its own folder with .\ and its name, because PowerShell never looks in the current folder for a command on its own.
- Run It from Anywhere (Apprentice): A script that reads its files from $PSScriptRoot works from any folder; a Scripts folder on your PATH lets you run it by name, pwsh -File starts it from outside PowerShell, and a desktop shortcut with pwsh -File in its target runs it with a double-click.