If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
capturing external commands exit codes in Win98
I'm writing a script that captures the return code from a command EXE file
and acts according to the code. I have a variable called intErr that captures the exit code from the command: intErr = objShell.Run(" %comspec% /C mycommand" , 9, True) The code works well in Win2K and XP, but it doesn't work in 98. Windows 98 seems to always return 0 (succesful execution). When I go in 98 and run command.com /Z and execute this manually, I can see the correct return code in this format: Return code (ERRORLEVEL): 2 What I've done so far: 1. I tried checking for the OS version and running %comspec% /Z in case of 98 but this does not work. (It opens a command window, does not execute my probgram and exits with 0). 2. I tried writing a batch file that can be invoked from the script that contains the following: @Echo Off %comspec% /Z mycommand This doesn't work either. For some reason you can't use batch with command.com /Z 3. I've tried concatenating the command to the shell. Doesn't work. 4. I tried modifying the config.sys with the following line: SHELL=C:\COMMAND.COM C:\ /E:4096 /P /Z This doesn't make all my command lines to behave like I want. I think the problem is that 98 does not store the %errorlevel% environment variable, so you have to use command.com /Z strictly to get this. Any Ideas? |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Prodcut Codes for Win98 | DonnieBoy | Disk Drives | 1 | July 4th 04 07:02 PM |