Does anyone have a good method for catching error's in .cmd files and sending to a text file or pause it? As I've read there can be like 256 or so errorlevel's
Thought I seen something here once before but can't find it for nothing.
Page 1 of 1
cmd file help error
#2
Posted 22 September 2004 - 01:37 PM
Hey maxXPsoft,
I was wondering something similar when trying to troubleshoot a .cmd file the other day.
The only thing I was able to find was that if you put a eg.">>C:\test.log" after every command that you execute, it will send the results to the example test.log.
Example. "C:\dir>>C:\test.log" outputs what you would see if you ran that command in dos.
I hope this is what you were asking about, and I hope it helps!
I was wondering something similar when trying to troubleshoot a .cmd file the other day.
The only thing I was able to find was that if you put a eg.">>C:\test.log" after every command that you execute, it will send the results to the example test.log.
Example. "C:\dir>>C:\test.log" outputs what you would see if you ran that command in dos.
I hope this is what you were asking about, and I hope it helps!
#3
Posted 23 September 2004 - 03:56 AM
In NT4/2K/XP/2003 the latest ERRORLEVEL generated is stored by system in variable called, guess what?, ERRORLEVEL, so that to log them you just need something along the lines of:
See here for more info and details:
http://www.robvander...errorlevel.html
jaclaz
..... @ECHO OFF if exist %TEMP%\logfile.log del %TEMP%\logfile.log if not exist %TEMP%\logfile.log ECHO [Logfile start] > %TEMP%\logfile.log :doing_SOMETHING DIR C:\ ::this ^ is the SOMETHING action Echo DONE SOMETHING RESULTING ERRORLEVEL IS %ERRORLEVEL% >> %TEMP%\logfile.log ......
See here for more info and details:
http://www.robvander...errorlevel.html
jaclaz
- ← Unattended Windows Installer Gui in C++?
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Programming for active desktop →
Share this topic:
Page 1 of 1



Help
Back to top









