NAME
Parse-FileName
SYNOPSIS
Parses FileName.
SYNTAX
Parse-Filename [[-f] <String>] [<CommonParameters>]
DESCRIPTION
Parses FileName and returns string with PS1 extension if not provided or whole default string with current datetime in format: yyyyMMdd_HHmmss-NewScript.ps1.
Returns same string when extension was provided with FileName.
PARAMETERS
-f <String>
FileName to parse.
Required? false
Position? 1
Default value $FileName
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Author : Sebastian Ziółkowski
Website: ziolkowsky.wordpress.com
GitHub : github.com/ziolkowsky
-------------------------- EXAMPLE 1 --------------------------
PS>Parse-FileName TestFile
Returns: TestFile.ps1
-------------------------- EXAMPLE 2 --------------------------
PS>Parse-FileName
Returns: 20220415_212359-NewScript.ps1 (based at current Get-Date)
-------------------------- EXAMPLE 3 --------------------------
PS>Parse-FileName TestFile.txt
Returns: TestFile.txt
RELATED LINKS
https://ziolkowsky.wordpress.com/2022/04/16/parse-filename/
https://github.com/ziolkowsky/ShellPowerFramework
Dodaj komentarz