PowerShell: Create Files and Folders

To create a file:

New-Item somefile.txt

To create a folder:

mkdir somedir
New-Item -ItemType Directory somedir
# Or
ni -it dir somedir

To create a file with parent folders:

echo $:PROFILE
New-Item $PROFILE -Force
# Or
ni $PROFILE -f

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *