running .exe in windows scripting host

Hi,

I have this code to run .exe using Windows scripting host. I am getting this error "The system cant find the file specified."
Is the code right?  I am new to WSH.  I have run the same exe before and the path is correct. arg1 is the argument that needs to be passed to test.exe.   Please help. Thank you.

Dim shell
Dim quote
Dim pgm
Dim arg
set shell = WScript.CreateObject("WScript.Shell")
quote = Chr(34)
pgm = "C:\test\bin\Debug\test.exe"
arg = "arg1"
shell.Run quote & pgm & " " & arg


enggAsked:
Who is Participating?
 
EDDYKTCommented:
Try

shell.Run quote & pgm &  quote & " " & arg
0
 
enggAuthor Commented:
Thanks EDDYKT for ur prompt reply.  It worked. Sorry for taking time to get back to u!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.