· Copy con file1 < Press enter key> · Again press enter key · Press F6 key · Press enter key You will see a message – 1 file(s) copied. Now onwards, whenever your computer is started, the date and time of start will be stored in file2. You can check all dates and times by giving command: "Type file2" at DOS prompt of root directory. This program works with DOS 6.22 and previous versions and also with Win9x. It may not work with Win NT and Windows 2000. Explanation of program: 1) date < file1 >> file2 To understand above statement, we split it into two statements: date >> file2 date < file1 The ">>" operator is a redirection operator, used to append (add text to end of a file) output of the command/file on its LHS to the file on its RHS. Hence "date >> file2" will append output of date command to output file. Similar case is with time command. Now, the problem is that the date and time commands seek input from the user by prompting: "Enter new time/date". At this time we have to press ENTER key. In our program we store ENTER in file1. "date < file1" statement redirects its output (i.e. ENTER) to date command. Hence we don’t need to press ENTER key manually. 2) "echo." statement leaves one line blank. This blank line is further redirected to file2. It will leave one line blank after every date and time. 3) "@echo off" causes all
statements to execute invisibly. |
|
|