David Griffin
David Griffin

Reputation: 11

Command to Create New File in Current Directory

I'd like to Create a New Text Document in the Current Directory, named "New Text Document" that is created with the text Highlighted for Renaming, the same as if you right-click the open folder > New >Text Document

I'd prefer to do it straight from the Command Line, or if not possible, then a Batch Script

I'd like to just point to %windir%\System32\notepad.exe and make it create a new Document in the current folder, or maybe somehow launch it from the Current Directory somehow..

or I thought about creating a file called "New Text Document.txt" elsewhere on the computer, and maybe pointing to that file, and copying it to the current directory.. but I'd like it to go straight to renaming.

anyone know if thats possible or not?

thanks

Upvotes: 1

Views: 1274

Answers (1)

Iswanto San
Iswanto San

Reputation: 18569

Try this:

echo 2> NewTextDocument.txt

This will redirect any error to NewTextDocument.txt. Since this command is valid (no error), it will produce new file with empty content.

More about redirecting: wikipedia

Upvotes: 1

Related Questions