I am making a console vbs script that does a for loop whilst running the following command:
NET Helpmsg #
'#' means the error code, so the script must count from 0 to 9999 then write each error as well as its error code into a text file.
My question is how do I tell cscript to ignore the following output of the net helpmsg command:
%1 is not a valid Windows network message number.
More help is available by typing NET HELPMSG 3871.
This means that the error code does not exist and I would want to have this error ignored and therefore not added to the txt file. Is there some way to do this?
I am able to redirect STDOUT and STDERR to two seperate text files, however when doing this you have to know which error codes don't exist then tell them to manually go to stderr.txt.
Try something like that into a batch file :
@echo off
If Exist HelpLog.txt Del HelpLog.txt
(
for /l %%i in (1,1,999) do @net helpmsg %%i 1>NUL 2>&1 && echo %%i & net helpmsg %%i | findstr /i "[a-z]"
)>> HelpLog.txt
Start "" HelpLog.txt
pause