The Unix command touch
is used to create a file if it doesn't exist or if the file already exists we can Access and Modify timestamps.
But these UNIX commands will not work in Windows. So to create a new file, there are two touch equivalent commands in windows.
type nul >> "index.js"
copy nul >> "index.js"
But most of the developers find these commands difficult to use, So there is a way to use the actualtouch
command in our windows.
Yep! you heard it right. There is actually a way to do this.
There is an npm package called touch-cli which will allow us to use touch
command.
Open up your terminal(command prompt) and paste the following code in it.
npm install touch-cli -g
Now you can use touch
command in CMD.
touch index.js