It's a sunny day here in the Seattle area, so let's have some command line fun. 🙂
Have you ever needed to create a small text file while working at a command line? I've been using the following technique since my MS-DOS days.
Creating files at the command line is very simple, using the
copy command. Here's how:
- While in a Command Prompt window, navigate to your desired folder. I will use c:\test in this example.
C:\> cd test
- Instruct the
copycommand to copy the console (CON) data to your file (ex: notes.txt)
C:\test> copy con notes.txt
- Type your desired text
This is a simple file created via the copy command
- Save the file using
Ctrl+Zand pressing the
The console window will show the following
1 file(s) copied.
If you decide you do not wish to create the file, you can cancel using
Ctrl+C and pressing the
It is important to note that once you press the
Enter key (on any line of your file), it is not possible to go back and make changes. For this reason, for any file longer than a line or two, I don't recommend this technique. I suggest using Notepad or your favorite text editor instead.
I was searching the Microsoft Help and Support site while writing this and found the following additional tip:
This tip is extremely cool if what you are looking to do is add a line or two to an existing file.
This posting is provided "AS IS" with no warranties, and confers no rights.