|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Wsh (jscript) argument looping
hi!
when i call this script, it doesnt display the arguments i passed: ====== var oArgs; oArgs = WScript.arguments; if (oArgs.length != 4) { //send email saying no backup argument was found WScript.Echo("no argument was passed"); WScript.quit(); } else { WScript.Echo(oArgs.length); for(var i=0; i < oArgs.length; i++) { WScript.Echo(oArgs[i] ); } } ====== any ideas why? thank you! joey |
|
#2
|
||||
|
||||
|
Erm, this is the JavaScript forum - JScript is a whole nother
headache! I think the Windows forum is more appropriate for this, so I'll move it there for you. ![]()
__________________
Support requests via PM will be ignored! |
|
#3
|
||||
|
||||
|
Apologies for replying to this one late as well. You're problem lies with your array items. Array items in JScript are called using parenthesis, not brackets.
Here's your functional code: Code:
JScript
var oArgs;
oArgs = WScript.arguments;
if (oArgs.length != 4) {
//send email saying no backup argument was found
WScript.Echo("no argument was passed");
WScript.quit();
}
else {
WScript.Echo(oArgs.length);
for(var i=0; i < oArgs.length; i++) {
WScript.Echo(oArgs(i));
}
}
|
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > Wsh (jscript) argument looping |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|