//---test.bat
cscript test.vbs
echo %ERRORLEVEL%
//--test.vbs
WScript.Quit 1
//------------------------------------
Regards,
Vassiliev V. V.
http://www-sharp.com - best scripting/HTA IDE
"Tomtom" <anon...@discussions.microsoft.com> сообщил/сообщила в новостях
следующее: news:8DCC61E2-7D17-43E2...@microsoft.com...
> I am calling a vbscript from a batch file. It'd be conveninent for me if I
can get a return value from the vbscript and use the value in the batch
file. Is this possible?
wsh.echo "set Result=" & MyResult
then execute the script in a FOR with a /F switch, like
this ...
for /f "delims=" %%a in (
'cscript yourscript.vbs') do %%a
echo The script returned: %Result%
This is for Win NT/2K/XP.
Other OS's require redirection into a temporary batch file
that is then CALLed and deleted.
Tom Lavedas
===========
>-----Original Message-----
>You should use %ERRORLEVEL% variable.
>
>//---test.bat
>cscript test.vbs
>echo %ERRORLEVEL%
>
>//--test.vbs
>WScript.Quit 1
>
>//------------------------------------
>Regards,
>Vassiliev V. V.
>http://www-sharp.com - best scripting/HTA IDE
>
>"Tomtom" <anon...@discussions.microsoft.com>
ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
>ÓÌÅÄÕÀÝÅÅ: news:8DCC61E2-7D17-43E2-8BEB-
1E1063...@microsoft.com...
"Tomtom" <anon...@discussions.microsoft.com> wrote in message
news:8DCC61E2-7D17-43E2...@microsoft.com...
> Have you tried using an Enviroment Variable?
> I haven't done anything with 'em , but if i remember correctly, wscript can
> access/modify enviroment variables.
> Theoretically, you should be able to have a bat file and a wsh script file
> "talk" back and forth, as much as you want
> using your own enviroment variables.
Hi
Updating the environment of a parent process is not trivial...
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:401ADCC1...@hydro.com...
If the batch file issues that set command before running a wsh script, the
wsh script will have no trouble finding the value of that variable. As
Torgeir says, though, actually modifying that variable so a new value will
be seen by the batch file after the wsh script has completed is non-trivial.
And this has nothing to do with whether the variable is a standard OS
variable like PATH, or a custom, script-specific variable like myVar.
/Al