I have two files: batch.bat and vbscript.vbs. The .bat file contains a loop where I need to call the .vbs, passing to it 2 arguments. The .vbs file contains a function with 2 arguments( the arguments I am passing to the .vbs file). I need to have access in the .bat file to the value my function in .vbs returns.
Could someone help me, please?
I am not an expert so please excuse my poor syntax. I am calling the .bat file. The files should look something like this
batch.bat :
loop start
' calling the vbs file
cscript vbscript.vbs arg1 arg2 ( here I suppose something has to be add to get val from vbs)
' using value returned by .vbs function
loop end
vbscript.vbs :
function myfunction(arg1,arg2)
dim value
' do some calculation
myfunction= value
end function
dim value_to_return_to_batch
' now calling the function
value_to_return_to_batch=myfunction(arg1,arg2)
'
' here something has to be add to send value_to_return_to_batch to batch
'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…