Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run a vbscript in dos file

Status
Not open for further replies.

FAT12

Programmer
Jun 2, 2005
17
0
0
FR
Hi,
I have a script in vb which returns 1 or 0 and this script is called in a dos file .bat.
Is it possible to get the value returned in my script.*
Thanks.
 
IF ERRORLEVEL 1 echo VBS returned 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks
I precise my problem
in my script I have a data which its value is 0 or 1 like this
Code:
Wscript.Echo  "Appel script"
Dim data
data=1
Wscript.Echo  "data: " & data
(it is a very simply example!)

and in my file .bat:
Code:
echo 'appel vbscript variable2 wihch returns 1 or 0'
cscript variable2.vbs
and I want to get the value of data.
I don't known if a vbscript can return a value.
Maybe I can use the standartd output ?

Thanks.
 
Hi,

What about:

Code:
WScript.Quit(data)

The value used by Quit is the error code that would work with the command line given by PHV

Spong
 
ok with this code:


.bat

Code:
@echo off

echo 'appel vbscript variable2 wihch returns 1 or 0'
cscript variable2.vbs > nil
IF "%ERRORLEVEL%" == "1" echo VBS returned %ERRORLEVEL%
echo %ERRORLEVEL%


vbscript

Code:
Wscript.Echo  "Appel script"
Dim data
data=1
Wscript.Echo  "data: " & data
wscript.Quit(data)

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top