Skip to content

cd-home

Sets the working directory to the user's home folder

#requires -version 5.1

try {
	if (-not(Test-Path "~" -pathType container)) { throw "The path to home directory '$path' doesn't exist (yet)" }
	$path = Resolve-Path "~"
	Set-Location "$path"
	$files = Get-ChildItem $path -attributes !Directory
	$folders = Get-ChildItem $path -attributes Directory
	"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
	exit 0
} catch {
throw
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.