Use "touch" command in Windows

Use "touch" command in Windows

·

1 min read

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.

  1. type nul >> "index.js"
    
  2. copy nul >> "index.js"
    

    But most of the developers find these commands difficult to use, So there is a way to use the actual touch command in our windows.

giphy.gif

                     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 Untitled4_AdobeExpress (1).gif

Thanks for Reading!