Skip to content

new-markdown-file

Creates a Markdown file

#Requires -Version 5.1

param([string]$path = "README.md")

try {
	if (Test-Path "$path" -pathType leaf) { throw "File '$path' is already existing" }

	$pathToTemplate = Resolve-Path "$PSScriptRoot/data/templates/New.md" 
	Copy-Item $pathToTemplate "$path"
	if ($lastExitCode -ne 0) { throw "Can't copy template to: $path" }

	"✅ New '$path' created (from data/templates/New.md)."
	exit 0
} catch {
throw
}

Specifies the path and new filename (README.md by default)

An interactive directory of PowerShell scripts.