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
Asked
Active
Viewed 493 times
2
-
1Batch don't support arrays, please try to use the correct terms to understand what you want (Tne next time) – ElektroStudios Nov 22 '12 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-script](http://stackoverflow.com/questions/10166386/arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch-script/10167990#10167990) – Aacini Nov 23 '12 at 03: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 Nov 23 '12 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"? ;-) http://stackoverflow.com/questions/10544646/dir-output-into-bat-array/10569981#10569981 – Aacini Nov 23 '12 at 14:19
1 Answers
1
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

ElektroStudios
- 19,105
- 33
- 200
- 417