Special feature of the copy command
The current operating system has long been Windows world, DOS has been yesterday yesterday. But some DOS commands, their vitality is still strong, often flashing in the DOS window, the copy command is one of them. Copy the file with a copy command, everyone is familiar, in fact, using the coupy command can also produce some special functions, let's introduce several special usage of the copy command, friends.
First, modify the date and time of the file
Use the COPY FileName NHL command to modify the date and time of the file filename to the current time, date of the system, but this command is only valid for text files because the empty device name NUL does not support binary modification. For example, the file length is only 86 bytes with the copy command.com nul command, which will cause file damage. We can create a zero-byte file, such as 0.NU, is implemented in a COPY / B / Y FileName 0.NUL command. A batch file can be prepared to complete the modified file date, time work, the following batch file can convert the date, time modified of all the files in the current directory, 0:00 on December 30, 1999.
Echo off
Date 12/30/1999
TIME 0
FOR%% FIN (*. *)
DOCOPY / Y / B %% F 0. Nul
Date
Time
Second, generate new files
You can create a text file with a copy con filename command. This usage is more familiar. In fact, this command can also generate a short executable (such as .com file).
For example, the CMOS of your machine is set by the password, you can't enter, the hard disk is also blocked in CMOS, but the machine can start from the floppy disk, and there is no tool on your boot floppy disk to use, you can use COPY Command to generate a small program to clear CMOS without opening the chassis discharge. Methods as below:
Type the copy conaly command, press the Alt key, use the number keypad to enter 176, 17, 213, 112, 176, 20, 230, 113, 205, 32 (note: one place input, encounter Release the Alt key) and finally end with the CTRL Z key. The program a.com is built, execute it, the CMOS information is cleared.
The procedure A.com disassembly instruction is as follows:
MOV Al, 11h
OUT 70H, Al
MOV Al, 14h
OUT 71H, Al
INT 20H
After this program is executed, the CMOS data is modified by the one byte, and the error message is displayed due to the self-test CMOS check error, and the CMOS can be entered according to the corresponding button.
Third, delete files
There is a Undelete command under DOS to restore the deleted file. If you want to delete the files you can't recover, you can use the following command: Copy Nul FileName, this command can completely delete the file. This deleted file cannot be recovered with Undelete and other software. The batch command below can completely remove all the files in the current directory.
Echo off
For %% f in (*. *) Do copy / y nul %% f
Fourth, the readability of the inspection file
For files on the floppy disk or disc, because of various reasons, it often occurs bad, and can use the copy *. * Nul command to check if the file on the disc is readable. If you use the XCOPY / S /.* NUL command, you can verify the readability of all files (including files within the subdirectory) on the entire disc, you may wish to try it when you purchase the disc.
V. Display text file content
The Type command is used to display the content of the text file, but it does not support file wildcards, and only one text file can be displayed at a time. When you need to find a file in a big pile, you may wish to use the Copy FileName CON command, which can display the contents of multiple text files at a time. You can display all the names and its contents of all .txt files, such as Copy * .txt con 6. Print file
Now the popularity of the family computer is very fast, when the computer edited by the computer in the computer needs to print, because the passenger is not flattering, but the unit's computer is more compulsed, there is no software installed, and the copy command can be used to complete the print. task. First, in the computer's printing to the file function in the computer, the print content is placed in the folder (such as dy.prn); then copy the file into the unit's computer, type: Copy /Bdy.prn PRN I.e.