Skip to content

Instantly share code, notes, and snippets.

@sagunji
Created May 20, 2019 05:30
Show Gist options
  • Save sagunji/5d151f594ee6ccb3609a1f59974248aa to your computer and use it in GitHub Desktop.
Save sagunji/5d151f594ee6ccb3609a1f59974248aa to your computer and use it in GitHub Desktop.
A function which represents file creation in powershell
function touch-equi {
param( [string[]]$files)
Foreach ($file in $files) {
if (Test-Path -Path $file) {
Write-Host "$file already exists."
continue
}
New-Item -ItemType file $file
}
}
touch-equi a.txt,b.txt,x.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment