Write a quick file without an editor or notepad from command line
This is an old trick you can use to quickly create ANY text file (.txt, .bat, .xml, etc..) from a command line. This can be very useful if you want to create a quick batch file or test the ability to write a file to a folder.
From a command prompt type:
- copy con filename.xyz (Substitute filename and xyz with the desired file name and extension – file.bat for example) and hit enter
- Start typing.. You are now writing line 1 of the file. To get to line two, just hit enter.
- When you are done and want to “close” the file – hit ctrl+z, release and then hit enter.
- You have now written your file.