我有两个文件:batch.bat 和 vbscript.vbs。.bat 文件包含一个循环,我需要在其中调用 .vbs,将 2 个参数传递给它。.vbs 文件包含一个带有 2 个参数的函数(我传递给 .vbs 文件的参数)。我需要在 .bat 文件中访问我在 .vbs 中的函数返回的值。
有人可以帮我吗?
我不是专家,所以请原谅我糟糕的语法。我正在调用 .bat 文件。这些文件应该看起来像这样
批处理.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
'