running .exe in windows scripting host

Posted on 2006-04-25
Last Modified: 2010-04-07

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

Question by:engg
    LVL 26

    Accepted Solution


    shell.Run quote & pgm &  quote & " " & arg

    Author Comment

    Thanks EDDYKT for ur prompt reply.  It worked. Sorry for taking time to get back to u!

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now