3

I need to convert a batch file to vbscript but am unfamiliar with both. If I can understand what is going on in the batch file I can work out the vbscript easy enough. Problem is the batch file runs a few cscript commands which is supposed to have a syntax of

cscript [script name] [host options] [script arguments]

However whomever wrote the batch file doesn't use it in a standard manner so if someone could explain the use of the command I can work out the rest.

Sample line: Filename and actual url's removed for safety sake

cscript file.vbs -a -r url -h url -o raw
4

4 回答 4

1

cscript invokes the scripting engine and tells it to use file.vbs. The remaining arguments are passed through to the script, it can access them from WScript.Arguments.Item(x) where x is the 0 based index for the argument.

http://technet.microsoft.com/en-us/library/ee156618.aspx

None of the arguments have any affect on cscript running, cscript requires arguments sent to it to be escaped with another / (eg //B)

于 2010-01-21T23:00:54.160 回答
0

有关 cscript 命令的帮助,您可以在命令窗口中键入以下命令

脚本/?

于 2013-07-26T12:03:52.687 回答
0

您也可以在此处下载 vbscript 手册以供参考。它是一个 chm 文件,因此请在该文件中搜索“Arguments”以了解如何使用 Wscript.Arguments 等等。

于 2010-01-22T00:51:19.487 回答
0

file.vbs 包含什么?发布后,我们可以看到额外参数发生了什么。我很确定那些被加载到 vb 脚本中并且与 cscript 环境没有任何关系。

于 2010-03-26T01:41:17.183 回答