CREATING LOG FILES
By Amitesh Singh
really great to make the log files. You should have some knowledge
of dos commands (including batch file programming, redirection and
MAKING LOG FILES
a txt file or edit a file in dos by using edit command and save as
I will show
CODING OF LOGGING
of the actual batch file that will log the user's activities is
%1>>c:\mylogfiles\usertxtlog.txt /*send the file
name of the file opened to the log
/*launch notepad so that user does not know some thing going
can add date and time command in the batch file, but one problem is
that you need to press enter too, which in turn has to be entered
in the batch file too(try this and see what happen).
echo FILE NAME:
As you are
the system administrator so this can give some clue to the user
that some thing is wrong in my computer. You can also remove this
fault by using pipeline tricks which I am now going to
DATE and TIME are
basically designed to interactively set the computer's record of
today's date and current time, but if we only want to use this
commands only to show the current date and time.
We can use
redirection of input to hand the enter key to the date and time
program. First, we create an empty batch file (let name is
empty.bat in C: directory) which is equivalent of the enter key
pressed by itself.
Then we dos a
command in this manner:
Now we can
make the above batch file smarter in this way:
echo FILE NAME:
any text file, select it (at once) and press the SHIFT key. Keeping
the SHIFT key pressed, right click on the txt file to bring up the
OPEN WITH.... option. Click on the OPEN WITH... option and choose
OTHER button and locate the batch file program which contains the
logging code and selecting the icon "always use this program to
open this type of files. Now click OPEN and OK.
exit command at the end of program to "MAKE THE LOGGING BATCH FILE
TO ESCAPE FROM THE USER'S EYES".
When any TXT file
will open there will be log entry in the file named
You can attach
this batch file to other types of files like
:Using the above
tricks you can easily change the files on which you want to
keep an eye.
If you want to
make log files in WordPad document then in the TXTLOG.BAT instead
of writing "notepad %1", write "write %1".
HOW TO MAKE LOG
FILES ON THE NET (only for Windows XP)
If you have
some knowledge of TELNET service then you can make log files of
each server connection.
First go to dos
& press enter.
Set log file
This txt file
will store all the works you have done on the net.
You can make a
batch file program which makes log files without going to type log
files each time.
HOW YOU RUN
echo Welcome to
the 'TELNET' service
echo type of
the service"/c:123456 /n
if errorlevel 6
if errorlevel 5
start c:\telnet %1 80
if errorlevel 4
start c:\telnet %1 110
if errorlevel 3
start c:\telnet %1 25
if errorlevel 2
start c:\telnet %1 21
if errorlevel 1
start c:\telnet %1 23
HOW YOU RUN
AUTHOR Amitesh Singh
Got something to add? Send me email.
Increase ad revenue 50-250% with Ezoic
More Articles by Amitesh Singh
© 2012-11-08 Amitesh Singh