Skip to content

General-touch

Create an empty file

param([string]$filename = "")

try {
	if ($filename -eq "") { $filename = Read-Host "Enter the filename" }
	"" | Out-File $filename -encoding ASCII
	"? Created a new empty file called '$filename'."
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

Path and filename of the new file

An interactive directory of PowerShell scripts.