Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Exiting VFP returning an error level
Message
De
30/11/1999 11:40:24
 
 
À
30/11/1999 11:08:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00296903
Message ID:
00296913
Vues:
19
>REM Here is my bat file called test.bat
>@echo off
>
>RetTest

In addition to the other message, this is not the correct mechanism to check the errorlevel return value. Instead, you should use an IF branch based on the errorlevel code - it is a number, not a string.
IF ERRORLEVEL 2 GOTO TWORHIGHER
IF ERRORLEVEL 1 GOTO EXACTLYONE
REM if it falls through to here, a zero was returned
echo The big zip
goto end
:TWOORHIGHER
echo something bigger than 1
goto end
:EXACTLY1
echo It came back 1
:END
This is documented in the Windows Help file, and the behavior is consistent since DOS 2.0 for examinign an error level.

>goto answer%ERRORLEVEL%
>
>:answer0
>echo Zero was returned
>goto end
>
>:answer1
>echo Negative one was returned
>goto end
>
>:answer
>echo Nothing was returned
>goto end
>
>:end
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform