Created
June 26, 2023 13:38
-
-
Save fslef/79de4763e3d3e6e1b8ed1612ff056659 to your computer and use it in GitHub Desktop.
New-File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-File { | |
param ( | |
$Path | |
) | |
if (Get-Item $path -ErrorAction Ignore) { | |
Write-Verbose "File $path already exists." | |
} | |
else { | |
New-Item -Path $path -ItemType File | Out-Null | |
Write-Verbose "File $path created successfully." | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment