Create a blank file

Unix/Linux

$ touch directory/filename.[extension]

Windows PowerShell

$ new-item -type file directory/filename.[extension]

Usage:

  1. Create a file or multiple files
  2. Create a directory
  3. Create a profile

$ New-Item -Path . -Name “testfile.txt” -ItemType “file” -Value “This is an example string.”

$ New-Item -Path “c:\” -Name “testdir” -ItemType “directory”

Learning resources

Windows PowerShell Documentation; Learning PowerShell @ Microsoft

Leave a Reply

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

Theme: Overlay by Kaira 2021 Jooho L.
Close Bitnami banner
Bitnami