|
This is really great to make the log files. You should have some knowledge of dos commands (including batch file programming,redirection and pipeline tricks). MAKING LOG FILES OF TXT LAUNCHING LOG FILES First open a txt file or edit a file in dos by using edit command and save as "file_name.bat". I will show you: C:\>edit txtlog.bat CODING OF LOGGING BATCH FILE The coding of the actual batch file that will log the user's activities is quiet simple. A simple example:? @echo off echo TXT FILE>>c:\mylogfiles\usertxtlog.txt echo %1>>c:\mylogfiles\usertxtlog.txt /*send the file name of the file opened to the log file,c:\mylogfiles\usertxtlog.txt*/ notepad %1 /*launch notepad so that user does not know some thing going wrong*/ exit Well you 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 off echo TXT FILE>>c:\mybatchfiles\amitesh.txt time>>c:\mybatchfiles\amitesh.txt echo FILE NAME: %1>>c:\mybatchfiles\amitesh.txt date>>c:\mybatchfiles\amitesh.txt time>>c:\mybatchfiles\amitesh.txt notepad %1 exit 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 discuss. 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: c:\>time<empty.bat Now we can make the above batch file smarter in this way:? TXTLOG.BAT @echo off echo TXT FILE>>c:\mybatchfiles\amitesh.txt echo FILE NAME: %1>>c:\mybatchfiles\amitesh.txt date<c:\empty.bat>>c:\mybatchfiles\amitesh.txt time<c:\empty.bat>>c:\mybatchfiles\amitesh.txt notepad %1 exit Now locate 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. I include 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 “amitesh.txt”. You can attach this batch file to other types of files like *.dat,*.html,*.ps……..etc. NOTE:?Using the above tricks you can easily change the files on which you want to keep an eye. CREATING LOGFILE IN WORDPAD 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 prompt. Type 'telnet' & press enter. Now type set? Set logfile c:\lognotes.txt. 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. Examples:? TEL.BAT @echo off telnet set logfile c:\log.txt open %1 %2 HOW YOU RUN IT C:\>TEL.BAT pop.mail.yahoo.com 110 ADTELNET.BAT @echo off echo Welcome to the 'TELNET' service echo type of server(ports) start echo 1:TELNET(23) echo 2:FTP(21) echo 3:SMTP(25) echo 4:POP(110) echo 5:HTTP(80) echo 6:EXIT choice "choose the service"/c:123456 /n if errorlevel 6 goto end 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 :end HOW YOU RUN IT C:\>adtelnet.bat hotpop.com AUTHOR:Amitesh Singh ISM,Dhanbad
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
Related Items:
|