Copy con

Updated: 03/13/2021 by Computer Hope
copy command

Copy con is an MS-DOS and Windows command line command that allows the creation of a text file or batch file through the command line. To utilize this command, type "copy con" followed by the name of the file you want to create, as shown below.

copy con myfile.txt

After this command is typed, you are returned to a blank line, which is the start of your file. Enter the lines you want to insert in the file and, when done, press Ctrl+Z to create the file. To cancel the creation of the file, press Ctrl+C.

Note

In Windows 10, after you press Ctrl+Z, press Enter to save and close the file.

Tip

The method above is great, but if you need to edit a file or something larger, use a text editor, such as Windows Notepad. You can start Notepad from a command line using the start command.

Note

In Windows 8 and 10, if there is text already in the file, pressing Ctrl+C deletes the last line of text and saves the file. If you are on the first line or have not typed any text, pressing Ctrl+C cancels the creation of the file.

Copy, Software terms