Many times we can do our tasks in batch mode. I personally like this approach and I use it alot in
my daily office work. In this post we will learn a very simple but very usefull trick to make our
batch files more usefull.
I have 3 batch files which have some operation in them (anything)
I want to execute these batch files in one go and want to create a log file for actions happened inside the batch file.
1. Open ‘Notepad’ and create a new file. save this file as “Main,cmd” (you can choose nay name you like )
2. Create a variable which contains our Logfile name.
3. Copy an d paste below mntioned lines in this file and save it .
REM Create a logfile name variable
ECHO This is first log line >> %LOGFILE%
ECHO Calling first file ‘file1.cmd’ >> %LOGFILE%
REM file1.cmd >> %LOGFILE%
ECHO Calling file ‘file2.cmd’ >> %LOGFILE%
REM file2.cmd >> %LOGFILE%
ECHO Calling file ‘file3.cmd’ >> %LOGFILE%
REM file3.cmd >> %LOGFILE%
ECHO Task completed >> %LOGFILE%
ECHO. >> %LOGFILE%
4. Run this file by double click on it .
Voilaa now you have new log file.
Note : If you have “Trace32” log viewer you can directly lauch it loaded with your log file
START trace32.exe %LOGFILE%