Hi I would like to know as to how I can pass an array to vbscript file. I have 5text files containing integers. I read them in a batch program and have to pass those 5 integers to the vbscript file and detect them in vbscript
-
1Batch don't support arrays, please try to use the correct terms to understand what you want (Tne next time)ElektroStudios– ElektroStudios2012-11-22 18:47:34 +00:00Commented Nov 22, 2012 at 18:47
-
1@ElektroHacker: Excuse me. Independently of the fact that the question is not properly written, Batch files do support arrays. See: arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch-scriptAacini– Aacini2012-11-23 03:58:46 +00:00Commented Nov 23, 2012 at 3:58
-
Hello, @Aacini that's a custom try to create an array, I saw more examples like that in my life but you know Batch don't support array by himself. see all the other answers in that posts, they corraborate me. (sorry for my english)ElektroStudios– ElektroStudios2012-11-23 10:35:38 +00:00Commented Nov 23, 2012 at 10:35
-
1@ElektroHacker: Interesting comment! Did you read the links of that answer? Do you know C programming language (at least a little bit)? Do you think, like me, that C programming language "don't support Input/Output operations by himself"? ;-) stackoverflow.com/questions/10544646/dir-output-into-bat-array/…Aacini– Aacini2012-11-23 14:19:18 +00:00Commented Nov 23, 2012 at 14:19
Add a comment
|
1 Answer
I don't know if this is what you want:
How to use:
Integers.vbs "number1" "number2" "number3" "number4" "number5"
Integers.vbs
' set the vars
Integer1 = Wscript.Arguments.Item(0)
Integer2 = Wscript.Arguments.Item(1)
Integer3 = Wscript.Arguments.Item(2)
Integer4 = Wscript.Arguments.Item(3)
Integer5 = Wscript.Arguments.Item(4)
' Print all the args
Set objArgs = WScript.Arguments
For Each strArg in objArgs
WScript.Echo strArg
Next