Skip to content

Commit f177f22

Browse files
author
Markus Fleschutz
committed
Renamed to new-powershell-script.ps1
1 parent 29d27ee commit f177f22

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
<#
22
.SYNOPSIS
3-
Creates a new PowerShell script
3+
Creates a PowerShell script
44
.DESCRIPTION
5-
This PowerShell script creates a new PowerShell script file by using the template file at: ../data/templates/PowerShell.ps1.
5+
This PowerShell script creates a new PowerShell script file by using the template ../data/templates/New.ps1.
66
.PARAMETER path
7-
Specifies the path and new filename
7+
Specifies the path and new filename ("bot.ps1" by default)
88
.EXAMPLE
9-
PS> ./new-script.ps1 bot.ps1
9+
PS> ./new-powershell-script.ps1
1010
✅ New PowerShell script 'bot.ps1' created from template 'PowerShell.ps1'.
1111
.LINK
1212
https://github.com/fleschutz/PowerShell
1313
.NOTES
1414
Author: Markus Fleschutz | License: CC0
1515
#>
1616

17-
param([string]$path = "")
17+
param([string]$path = "bot.ps1")
1818

1919
try {
20-
if ($path -eq "" ) { $path = Read-Host "Enter the new filename" }
21-
22-
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/PowerShell.ps1"
20+
$pathToTemplate = Resolve-Path "$PSScriptRoot/../data/templates/New.ps1"
2321
Copy-Item $pathToTemplate "$path"
2422
if ($lastExitCode -ne 0) { throw "Can't copy to: $path" }
2523

26-
"✅ New PowerShell script '$path' created from template 'PowerShell.ps1'."
24+
"✅ New '$path' created (from data/templates/New.ps1)."
2725
exit 0 # success
2826
} catch {
2927
"⚠️ Error: $($Error[0])"

0 commit comments

Comments
 (0)