Re: Passed arguments not being passed to target script
- From: "Michael Harris \(MVP\)" <mikhar at mvps dot org>
- Date: Thu, 26 Jan 2006 17:32:31 -0800
tdc wrote:
> The debug statements include a write to text file after the execute
> statement. I then take what was written to the file and paste that
> in the command line and still get a zero in the number of arguments
> passed to the vb script. Since the scripts that I am using have
> company information I created testing scripts and get the same
> result. Below are the scripts I am using:
I don't see any issue with either script. They work fine for me on xp pro
sp2 as they do on one of your w2k sp4 servers. I assume that in both of
your server cases, the scripts are local to each server and that you execute
the *.js starter script as an interactive logged on user.
The receive.vbs test script you posted would fail with 'subscript out of
range' unhandled runtime error if no arguments are passed. I realize these
are contrived examples to demonstrate, but are you actually running these
examples as a repro case on the actual servers involved?
> //Starting script
> var sPath ="C:";
> var sExecute = "receive.vbs";
> var sParams ="One Two Three Four";
> var objShell;
>
> sExecute = "\"" + sPath + "\\" + sExecute + "\"" + " " + sParams;
> objShell = new ActiveXObject("WScript.Shell");
> objShell.run(sExecute);
>
>
> Below is what is being passed to:
> Option Explicit
> dim Args
> dim counter
> set args=Wscript.Arguments
> for counter = 0 to args.count-1
> msgbox "Argument value: " & args(counter) & " " & "Count of
> Arguments: " & counter +1
> next
>
> dim temp
> temp = wscript.arguments.item(0)
> temp = temp & " " & wscript.arguments.item(1)
> temp = temp & " " & wscript.arguments.item(2)
> temp = temp & " " & wscript.arguments.item(3)
>
> msgbox "Final interation: " & temp
>
> "Michael Harris (MVP)" wrote:
>
>> tdc wrote:
>>> In a java script I am calling the WScript.shell "Run" method. In
>>> the run statement I am including the path to the vbs script and a
>>> list of arguments. Debug statements written to a text file after
>>> execution verifies the correct script and the arguments being
>>> generated. The target vbs script errors because no arguments are
>>> being passed to it. On another server this works perfectly but not
>>> on this one. Both target servers are Windows 2000 with service
>>> pack 4. Is there some security setting that I am missing or
>>> something else? Very frustrating.
>>
>> I've never heard of an issue of the same .Run command line with the
>> same fully qualified *.vbs local path plus arguments behaving
>> differently on different machines with the same OS/WSH version, let
>> alone that only argument passing would be affected in any way by
>> security settings. How do you *know* that arguments aren't being
>> passed? What does "...Debug statements written to a text file after
>> execution..." mean specifically? Written by whom/what?
>>
>> What the script does based on passed arguments *may* be different on
>> different machines depending on the execution security context of
>> the script and/or permissions on local/remote resources it tries to
>> access.
>>
>> --
>> Michael Harris
>> Microsoft MVP Scripting
--
Michael Harris
Microsoft MVP Scripting
.
- Follow-Ups:
- References:
- Re: Passed arguments not being passed to target script
- From: Michael Harris \(MVP\)
- Re: Passed arguments not being passed to target script
- From: tdc
- Re: Passed arguments not being passed to target script
- Prev by Date: cscript errors when running many concurrent vbs scripts
- Next by Date: Re: cscript errors when running many concurrent vbs scripts
- Previous by thread: Re: Passed arguments not being passed to target script
- Next by thread: Re: Passed arguments not being passed to target script
- Index(es):
Relevant Pages
|
Loading