How to create an empty file at the DOS/Windows command-line?
I tried:
copy nul > file.txt
but it always displays that a file was copied.
Is there any other method in the standard cmd?
It should be a method that does not require the touch command from Cygwin or any other nonstandard commands. The command needs to run from a script so keystrokes cannot be used.
Here's another way:
Here is yet another way:
The slash
/
is mandatory; without it the redirection part was commented out byrem
.Run CMD in admistrator mode and type this:
or you type this
Use
copy > your_file_name.extension
in command prompt likeso you can create an empty file with
navigate to the directory and type the above command in PowerShell window.
Note this will not work on windows command prompt.
Today I've discovered a new one :)
This will change the command line window title, but will also create a empty file.