From: Matthias Tacke on
Am 2010-07-14 13:10, schrieb Pegasus [MVP]:
>>> shell.Run "cmd.exe /c tnsping.exe sBase >> liste.out"
>>
>> OK thanks
>> I think I missed something
>> sBase is not replaced by his value, no ?
>> can you help me ?
>> Thanks again
>
> Sorry, I cannot understand your question - please rephrase.

Hello Pegasus,

I think he wanted to pass the actual value of sBase to the commandline

shell.Run "cmd.exe /c tnsping.exe " & sBase & " >> liste.out"

--
Regards
Matthias
From: Tom Lavedas on
On Jul 14, 7:10 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote:
> "bob123" <bob...(a)gmail.com> wrote in message
>
> news:4c3d8b69$0$10807$426a74cc(a)news.free.fr...
>
>
>
>
>
> >>> Dim fso, infile, aNames, sBase, shell
> >>> set fso = createobject("scripting.filesystemobject")
> >>> set infile = fso.opentextfile("liste.txt",1)
> >>> Set shell = WScript.CreateObject("WScript.Shell")
>
> >>> aNames = Split(infile.readall, vbnewline)
> >>> infile.close
>
> >>> for each sBase in aNames
> >>> wsh.echo "Base:", sBase
> >>> shell.Run "tnsping sBase >> liste.out"
> >>> Next
>
> >> Redirecting console output is a property of cmd.exe. Your executable
> >> tnsping.exe (if this is the correct name) cannot do it. You need to use
> >> something like
>
> >> shell.Run "cmd.exe /c tnsping.exe sBase >> liste.out"
>
> > OK thanks
> > I think I missed something
> > sBase is not replaced by his value, no ?
> > can you help me ?
> > Thanks again
>
> Sorry, I cannot understand your question - please rephrase.

You missed the "concatenation of a variable" step. That is, this ...

shell.Run "cmd.exe /c tnsping.exe sBase >> liste.out"

should be ...

shell.Run "cmd.exe /c tnsping.exe" & sBase & " >> liste.out"
_____________________
Tom Lavedas
From: bob123 on

> Hello Pegasus,
>
> I think he wanted to pass the actual value of sBase to the commandline
>
> shell.Run "cmd.exe /c tnsping.exe " & sBase & " >> liste.out"
>
> --
> Regards
> Matthias

You are correct Matthias
but now, I got only the first "tnsping sBase" in liste.out
any idea ?
Thanks


From: Matthias Tacke on
Am 2010-07-14 14:32, schrieb bob123:
>> Hello Pegasus,
>>
>> I think he wanted to pass the actual value of sBase to the commandline
>>
>> shell.Run "cmd.exe /c tnsping.exe "& sBase& ">> liste.out"
>>
>> --
>> Regards
>> Matthias
>
> You are correct Matthias
> but now, I got only the first "tnsping sBase" in liste.out
> any idea ?
> Thanks
>
>
See <http://msdn.microsoft.com/en-us/library/d5fk67ky%28VS.85%29.aspx>
for additional arguments for .run

I guess vbscript starts the tnspings in parallel so the output file
gets overwritten or blocked.

Try:
shell.Run "cmd.exe /C ping.exe -n 1 " & sBase & " >> liste.out",0,true

--
Regards
Matthias
From: bob123 on

> See <http://msdn.microsoft.com/en-us/library/d5fk67ky%28VS.85%29.aspx>
> for additional arguments for .run
>
> I guess vbscript starts the tnspings in parallel so the output file
> gets overwritten or blocked.
>
> Try:
> shell.Run "cmd.exe /C ping.exe -n 1 " & sBase & " >> liste.out",0,true

Thanks Matthias it work's now ...