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
strSysname = "Server1"
strBatch = "c:\temp\SvrChk.bat " & strSysname
objShell.Run (strBatch), 0, True
I think if you used something like Filemon from sysinternals you'd find your
code was trying to use the entirity of strBatch as the file to execute
"Jeff" <jeff...@state.nm.us> wrote in message
news:1176157438.6...@e65g2000hsc.googlegroups.com...
> 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
Good Luck, Ayush.
--
Scripting- your first steps :
http://www.microsoft.com/technet/scriptcenter/topics/beginner/firststeps.mspx
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
Hi Adam,
You hit the nail on the head, your solution worked. Thanks.