INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

run a vbscript in dos file

run a vbscript in dos file

(OP)
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.

RE: run a vbscript in dos file

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

RE: run a vbscript in dos file

(OP)
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.

RE: run a vbscript in dos file

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

RE: run a vbscript in dos file

(OP)
it doens't work !

RE: run a vbscript in dos file

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close