In a lot of MacOS and Linux-based tutorials, we see people create empty files using touch
command. For example, they just write:
touch index.js
And it creates a new file. However, there is no touch
in Windows command line. The only alternative we have is a long-form command called fsutil
. This will let you create a zero byte file via cmd
.
Here is the syntax for fsutil
to create a new file in Windows cmd:
fsutil file createnew filename requiredSize
Here is an example of fsutil
in action:
fsutil file createnew index.js 0
You will get a response that looks something like this:
index.js is created
If you get the following error:
The FSUTIL utility requires that you have administrative privileges.
It means that you're not running your cmd
as an admin. You need to run your cmd
as an admin for it to work.
To check if your file has been created correctly, use dir
. For example:
dir index.js
This will return something like this:
07/19/2021 11:26 PM 0 index.js
1 File(s) 0 bytes
0 Dir(s) 961,229,201,408 bytes free