Renamed template to New.txt

This commit is contained in:
Markus Fleschutz 2025-06-05 14:08:21 +02:00
parent 370e08c2d9
commit 29d27eec18
3 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
Your Headline Headline
============= ========
Some introductory words... Some introductory words...

View File

@ -1,5 +1,5 @@
Your Headline Headline
============= ========
Some introductory words... Some introductory words...

View File

@ -1,13 +1,13 @@
<# <#
.SYNOPSIS .SYNOPSIS
Creates a new text file Creates a text file
.DESCRIPTION .DESCRIPTION
This PowerShell script creates a new .txt file from template file at: ../data/templates/Text.txt. This PowerShell script creates a new .txt file from: ../data/templates/New.txt.
.PARAMETER path .PARAMETER path
Specifies the path and new filename (README.txt by default) Specifies the path and new filename (README.txt by default)
.EXAMPLE .EXAMPLE
PS> ./new-text-file.ps1 PS> ./new-text-file.ps1
New file 'README.txt' created from template 'Text.txt'. New 'README.txt' created (from data/templates/New.txt).
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -17,11 +17,11 @@
param([string]$path = "README.txt") param([string]$path = "README.txt")
try { try {
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/Text.txt" $pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/New.txt"
Copy-Item $pathToTemplate "$path" Copy-Item $pathToTemplate "$path"
if ($lastExitCode -ne 0) { throw "Can't copy template to: $path" } if ($lastExitCode -ne 0) { throw "Can't copy template to: $path" }
"✅ New file '$path' created from template 'Text.txt'." "✅ New '$path' created (from data/templates/New.txt)."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0])" "⚠️ Error: $($Error[0])"