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.

3 Answers

From this answer on Stack Overflow

type nul >file
echo. 2> file

Give that one a try

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

:)

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like