Log in ....Tribune


Dot.ComLatest in ITFree DownloadsOn hardware

Monday, May 28, 2001
Article

Keeping vigil on your personal computer
Sarabjeet Singh Kanwal

WHEN you are not at home, if someone uses your PC, you may want to note the date and time your PC starts to keep a tab on the activity in your absence. Here we present a wonderful program step-by-step, which activates each time when your PC starts and stores the date and time in a file without knowledge of the user.

Step 1:

A file named autoexec.bat is present in the root directory of your bootable disc.

Add following statements to the end of this file:

@echo off

date < file1 >> file2

time < file1 >> file2

echo. >> file2

Caution: Don’t delete the previous contents of autoexec.bat file. Just add these statements to the end of the file, lest your PC may not work properly.

 


Step 2:

Now you have to create a file named file1 from DOS prompt, in the same root directory where autoexec.bat is placed. File1 is to be created as shown below:

· 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:
Whenever your computer starts, statements in autoexec.bat file are automatically executed.

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.

Home
Top