mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-19 19:27:52 +02:00
Renamed template to New.txt
This commit is contained in:
parent
370e08c2d9
commit
29d27eec18
@ -1,5 +1,5 @@
|
||||
Your Headline
|
||||
=============
|
||||
Headline
|
||||
========
|
||||
|
||||
Some introductory words...
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
Your Headline
|
||||
=============
|
||||
Headline
|
||||
========
|
||||
|
||||
Some introductory words...
|
||||
|
@ -1,13 +1,13 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a new text file
|
||||
Creates a text file
|
||||
.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
|
||||
Specifies the path and new filename (README.txt by default)
|
||||
.EXAMPLE
|
||||
PS> ./new-text-file.ps1
|
||||
✅ New file 'README.txt' created from template 'Text.txt'.
|
||||
✅ New 'README.txt' created (from data/templates/New.txt).
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -17,11 +17,11 @@
|
||||
param([string]$path = "README.txt")
|
||||
|
||||
try {
|
||||
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/Text.txt"
|
||||
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/New.txt"
|
||||
Copy-Item $pathToTemplate "$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
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
|
Loading…
x
Reference in New Issue
Block a user