cmd version:
type nul > pathtofile
The file is now 0 byte size, and occupies 0 byte on disk.
powershell version:
$null > pathtofile
In this case, the properties of the file show us it’s now 2 bytes size then not completely empty. And the file uses 4 Ko size on disk (because of the cluster size: Cluster is the smallest unit to save and manage files in the disk in Windows OS. One cluster can only hold one file even if it is only one byte).
In the powershell version, regardless of the initial file size, there are always 2 bytes left. For the moment I didn’t find an explanation on that, but don’t hesitate to comment this post and give your point of view it will be really appreciated 🙂
Leave a Reply