views:

144

answers:

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
A: 

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)

taspeotis
A: 

you can also download the vbscript manual here for reference. Its a chm file, so search the file for "Arguments" to see how to use Wscript.Arguments and many more.

ghostdog74
A: 

what does the file.vbs contain? Once you post that we can see what is going on with the extra parameters. I'm pretty sure those are getting loaded into the vb script and don't have anything to do with the cscript environment.

Keng