Skip to content

Go-Root

Sets the working dir to the root dir

#requires -version 5.1

try {
	if ($IsLinux -or $IsMacOS) { $path = "/" } else { $path = "C:\" }
	Set-Location "$path"
	$folders = Get-ChildItem $path -attributes Directory
	$files = Get-ChildItem $path -attributes !Directory
	"??$path entered (has $($folders.Count) folders and $($files.Count) files)"
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0])"
	exit 1
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.