Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    vb script cannot find file (vb script)

    Trying to launch an EXE file from a script, and keep getting a "file not found" error message on the ObjShell.Run line. When I uncomment the "Notepad" line, then Notepad launches properly. When I copy-paste the EXE path from the script into Windows' Start > Run dialog, it launches properly. What is wrong with the following code that prevents the EXE program from launching properly?


    Option Explicit
    DIM sExepath

    sExepath = "C:Program FilesFERICMultiDATFLTMultiDAT.exe"
    'sExePath = "notepad"

    Dim objShell
    Set objShell = CreateObject("WScript.Shell")
    objShell.Run sexepath


    The O/S is Win2000 Pro. I am not logged in with Administrator permissions on the computer
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: vb script cannot find file (vb script)

    Try

    objShell.Run Chr(34) & sexepath & Chr(34)

    Since your path contains a space, it must be enclosed in quotes.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: vb script cannot find file (vb script)

    Ah yes, the famous missing quotes. Having them in the string definition is just not enough. One day, I will remember that <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

    Thanks very much.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •