Skip to content

Go-Autostart

Sets the working directory to the autostart folder

#requires -version 5.1

try {
	if ($IsLinux -or $IsMacOS) { throw "This script requires Windows" }

	$path = Resolve-Path "$($env:APPDATA)/Microsoft/Windows/Start Menu/Programs/Startup"
	if (-not(Test-Path "$path" -pathType container)) { throw "The path to autostart folder '$path' doesn't exist (yet)" }
	Set-Location "$path"
	$files = Get-ChildItem $path -attributes !Directory
	"??$path entered, has $($files.Count) files."
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0])"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.