PoshCode Archive  Artifact [f56e4c1362]

Artifact f56e4c13621f74532052a09a238f8ebb9b99d82c70ebe996c02d9f3c65c51b4d:

  • File PowerShell-Template.ps1 — part of check-in [db5bdc6141] at 2018-06-10 14:23:55 on branch trunk — I’ve modified the original function. I like this one better. (user: Gene Magerr size: 1206)

# encoding: ascii
# api: powershell
# title: PowerShell Template
# description: I’ve modified the original function. I like this one better.
# version: 1.0
# type: function
# author: Gene Magerr
# license: CC0
# function: New-Script
# x-poshcode-id: 778
# x-derived-from-id: 1563
# x-archived: 2010-01-26T13:32:22
#
#
Function New-Script
{
$strName = $env:username
$date = get-date -format d
$name = Read-Host "Filename"
if ($name -eq "") { $name="NewTemplate" }
$email = Read-Host "eMail Address"
if ($email -eq "") { $email="youremail@yourhost.com" }
$file = New-Item -type file "$name.ps1" -force
$template=@"
###########################################################################"
#
# NAME: $name.ps1
#
# AUTHOR: $strName
# EMAIL: $email
#
# COMMENT:
#
# You have a royalty-free right to use, modify, reproduce, and
# distribute this script file in any way you find useful, provided that
# you agree that the creator, owner above has no warranty, obligations,
# or liability for such use.
#
# VERSION HISTORY:
# 1.0 $date - Initial release
#
###########################################################################"
"@ | out-file $file
ii $file
}