Al
Tue Apr 10 23:41:39 CDT 2007
"Ayush" <"ayushmaan.j[aatt]gmail.com"> wrote in message
news:er34HCweHHA.1252@TK2MSFTNGP04.phx.gbl...
> [Jeff]s message :
>> Hi All,
>
>> I am trying to execute a batch file from a VBScript and it keeps
>> failing with "The system cannot find the file specified", code:
>> 80070002, failing on the objShell.Run line. I did a lot of searching
>> and this should work, but doesn't.
>
>> strSysname = "Server1"
>> strBatch = chr(34) & "c:\temp\SvrChk.bat " & strSysname & chr(34)
>> objShell.Run strBatch, 0, True
>
>> Can anyone out there help?
>
>> Jeff
>
> You are trying to run:
> "c:\temp\SvrChk.bat Server1"
> which is wrong.
>
> Use either
> "c:\temp\SvrChk.bat" Server1
> or
> c:\temp\SvrChk.bat Server1
quite correct. Converted back into vbscript we have:
strBatch = chr(34) & "c:\temp\SvrChk.bat" & chr(34) & " " & strSysname
or the form I prefer:
strBatch = """c:\temp\SvrChk.bat"" " & strSysname
/Al
>
>
> Good Luck, Ayush.
> --
> Scripting- your first steps :
>
http://www.microsoft.com/technet/scriptcenter/topics/beginner/firststeps.mspx