Run It from Anywhere

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.

Updated

Cheat sheet for the lesson Run It from Anywhere: 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…
Category
PowerShell
Level
Apprentice
Tags
path, powershell, psscriptroot, pwsh, shortcut