Unix Command Line 'Touch' command in Windows Command Prompt
Sun May 29 04:44:17 2011
I was asked the other day how to do the "touch" command in the command prompt on a Win machine to create a new file.
Anyone who uses the command line of Unix based environments will have most likely used the following command to create a new file.
touch fileName.fileExtenstion
Creating the file 'test.txt' is just a simple matter of touch test.txt
.
OK, nothing new there. So how do we do this in Windows? The answer is simple. Open the Command Prompt, navigate to a folder in which you wish to create a file (cd to the Desktop for example) and type the following command.
copy nul test.txt
and press enter.
That's it.
There are a bunch of extra arguments you could add in place of the nul
, like con
which will let you enter content directly from cmd. Anyway, I'll let you look for those... and that's how you do it.