A Windows 98 & ME forum. Win98banter

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.

Go Back   Home » Win98banter forum » Windows 98 » Shell
Site Map Home Authors List Search Today's Posts Mark Forums Read Web Partners

capturing external commands exit codes in Win98



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old September 18th 04, 04:46 AM
Robertson Pimentel
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Prodcut Codes for Win98 DonnieBoy Disk Drives 1 July 4th 04 07:02 PM


All times are GMT +1. The time now is 09:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Win98banter.
The comments are property of their posters.