Results 1 to 5 of 5

Thread: Shell command problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Location
    Colorado
    Posts
    8

    Unhappy Shell command problem

    I have a window I made to run some of my visual demos. I'm simply unloading that window and running another program from it. The syntax I'm using is:
    If RN = 1 Then Myprog = Shell("C:\My Documents\Chris Misc\Progname", 1)
    On some PC's this works fine, on others, when running the executable of my program, they get a path error. What can I do different to avoid the error?

    vbsslink

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    You're hardcoding the path, ie: "C:\My Documents\Chris Misc\Progname". On the computers it doesn't work on, the program you're trying to access must have a different path. If it's your program, look into the App.Path statement. Otherwise, you'll have to find a way to get the path of the program you're running.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Location
    Colorado
    Posts
    8

    Shell syntax

    The app.path seems to work fine for my record score, but I can't get it to work with the Shell command.

    I tried Myprog = Shell("App.Path\Progname", 1)

    I compiled it and ran it and got a path error. How can I use App.Path with the Shell command?

  4. #4
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431
    Like in the other post, App.Path is a variable, therefore you set it off from the string:

    VB Code:
    1. Myprog = Shell(App.Path & "\Progname", 1)
    Last edited by jemidiah; Oct 11th, 2003 at 06:50 PM.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Location
    Colorado
    Posts
    8

    app.path in shell command

    I tried it the way you last showed it the first time I tried it, but I forgot the '&'.

    Works fine.

    Thanks again, jemidiah!!!

Posting Permissions

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



Click Here to Expand Forum to Full Width