ps/Modules/Cole.PowerShell.Developer/Public/New-File.ps1

22 lines
473 B
PowerShell
Raw Permalink Normal View History

2023-05-30 22:51:22 -07:00
function New-File {
<#
.SYNOPSIS
This item creates a file if it does not exist.
.PARAMETER FilePath
[string] The appropriate path
#>
[CmdletBinding()]
[OutputType([System.IO.FileInfo])]
param (
[Parameter(Mandatory = $true, Position = 0)]
[Alias('FileName')]
[Alias('File')]
[Alias('Name')]
[string]$FilePath
)
if (!(Test-Path $FilePath)) {
New-Item -Path $FilePath -ItemType File -Force
}
}