cmd to vbscrip

January 4, 2011 at 17:09:02
Specs: Windows XP
how to pass data to vbscript and base

See More: cmd to vbscrip

Report •


#1
January 5, 2011 at 20:44:58
Put the data in variables:

cscript /nologo msgbox.vbs ""%thetitle%""
or
cscript /nologo msgbox.vbs "%thetitle%"
or
cscript /nologo msgbox.vbs %thetitle%

depending on how you set the variable.

in you VBScript
'Dim' the different variables in the order they were given. for example, if I have

cscript /nologo msgbox.vbs %thetitle% %thestyle% %thetext%

then I would need to put them in this order:

Dim title,style,text,return
text=args.item(0)
style=args.item(1)
title=args.item(2)
etc...

to return a value to batch file; for example, a msgbox, do:
if x=vbOK then
return=1
elseif x=vbCancel then
return=2
elseif x=vbAbort then
return=3
elseif x=vbRetry then
return=4
elseif x=vbIgnore then
return=5
elseif x=vbYes then
return=6
elseif x=vbNo then
return=7
end if
wscript.quit return

hope this helps.


Report •

#2
January 14, 2011 at 18:14:50
I also forgot a line in that:

set args=WScript.Arguments


Report •

Related Solutions


Ask Question