In Linux, the touch
command is used to generate a new file. However, in PowerShell, this command does not work; so, alternatives are used.
The easiest way is to use:
$null > filename
This generates a file in Unicode, so, the file will not be empty. To generate a file in ASCII use:
$null | sc filename
Another way to create files and folders is to use New-Item
:
ni filename
This creates a file or folder, depending on the extension given.
Sometimes it is also used to change the timestamps (i.e., dates and times of the most recent access and modification) on existing files and directories.
Free Resources