How do you create an empty file from the command line in Windows

What is the best way to create an empty file from the command line in windows?

I have been using the touch command but it isn't in stock windows.

One idea was to use echo . >file that works, but the file is never really empty that way. Is there a way to generate an empty file similar to what touch file would do using only what comes with stock windows.


Solution 1:

From this answer on Stack Overflow

type nul >file

Solution 2:

echo. 2> file

Give that one a try

Solution 3:

copy con file [Enter]
[F6] (or [Ctrl-Z]) [Enter]

:)