mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-23 14:18:38 +01:00
Add new-script.ps1
This commit is contained in:
parent
3308c4577f
commit
ec9253f38a
@ -177,6 +177,7 @@ pull-repo.ps1, pulls updates for the current/given Git repository (including sub
|
||||
pull-repos.ps1, pulls updates for all Git repositories under the current/given directory (including submodules)
|
||||
query-smart-data.ps1, queries the S.M.A.R.T. data of your HDD/SSD's and saves it to the current/given directory
|
||||
new-email.ps1, starts the default email client to write a new email
|
||||
new-script.ps1, creates a new PowerShell script
|
||||
reboot.ps1, reboots the local computer (needs admin rights)
|
||||
reboot-fritzbox.ps1, reboots the FRITZ!box device
|
||||
remove-empty-dirs.ps1, removes empty subfolders within the given directory tree
|
||||
@ -217,7 +218,6 @@ switch-shelly1.ps1, switches a Shelly1 device in the local network
|
||||
sync-repo.ps1, synchronizes a Git repository by push & pull (including submodules)
|
||||
take-screenshot.ps1, takes a single screenshot
|
||||
take-screenshots.ps1, takes multiple screenshots
|
||||
template.ps1, copy this template PowerShell script to write a new one
|
||||
translate-file.ps1, translates the given text file into another language
|
||||
translate-files.ps1, translates the given text files into any supported language
|
||||
translate-text.ps1, translates the given text into other languages
|
||||
|
Can't render this file because it has a wrong number of fields in line 86.
|
@ -227,8 +227,8 @@ Mega Collection of PowerShell Scripts
|
||||
| [list-modules.ps1](Scripts/list-modules.ps1) | Lists the PowerShell modules | [Manual](Docs/list-modules.ps1.md) |
|
||||
| [list-profiles.ps1](Scripts/list-profiles.ps1) | Lists your PowerShell profiles | [Manual](Docs/list-profiles.ps1.md) |
|
||||
| [list-scripts.ps1](Scripts/list-scripts.ps1) | Lists all PowerShell scripts in this repository | [Manual](Docs/list-scripts.ps1.md) |
|
||||
| [new-script.ps1](Scripts/new-script.ps1) | Creates a new PowerShell script | [Manual](Docs/new-script.ps1.md) |
|
||||
| [set-profile.ps1](Scripts/set-profile.ps1) | Updates your PowerShell user profile | [Manual](Docs/set-profile.ps1.md) |
|
||||
| [template.ps1](Scripts/template.ps1) | Copy this template PowerShell script to write a new one | [Manual](Docs/template.ps1.md) |
|
||||
|
||||
🛒 Various PowerShell Scripts
|
||||
------------------------------
|
||||
|
26
Scripts/new-script.ps1
Executable file
26
Scripts/new-script.ps1
Executable file
@ -0,0 +1,26 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
new-script.ps1 [<filename>]
|
||||
.DESCRIPTION
|
||||
Creates a new PowerShell script.
|
||||
.EXAMPLE
|
||||
PS> .\new-script.ps1 myscript.ps1
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
param([string]$filename = "")
|
||||
|
||||
try {
|
||||
if ($filename -eq "" ) { $shortcut = read-host "Enter the new filename" }
|
||||
|
||||
copy-item "$PSScriptRoot/../data/template.ps1" "$filename"
|
||||
|
||||
"✔️ created new PowerShell script $filename"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user