Results 1 to 15 of 15

Thread: [RESOLVED] Getting error trying to open .exe file using Shell

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Resolved [RESOLVED] Getting error trying to open .exe file using Shell

    When i try to open a .exe file using Shell i get this error:

    http://imagefire.systemous.com/ups/d...08-10%20PM.png

    The syntax of shell is:

    Shell "MyPrograms\..................\Hello.exe", vbMaximized Focus

    Any ideas?

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Getting error trying to open .exe file using Shell

    You will need the full path to the EXE

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Re: Getting error trying to open .exe file using Shell

    is it possible to find where exactly the folder which contains the .exe fiels is placed? Because i am not talking about a standard path.

  4. #4
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: Getting error trying to open .exe file using Shell

    Common dialog control.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Re: Getting error trying to open .exe file using Shell

    Can cd return the filepath without save/load? :S

  6. #6
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Getting error trying to open .exe file using Shell

    Quote Originally Posted by systemous View Post
    is it possible to find where exactly the folder which contains the .exe fiels is placed? Because i am not talking about a standard path.
    App.Path will return the path that the EXE is running from.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Re: Getting error trying to open .exe file using Shell

    I tried the app path but nothing. I decided to wirte the full path for a test but nothing. I created a shortcut of the game and tried to run it again but nothing again. the same stupid error again and again. any ideas?

  8. #8
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Getting error trying to open .exe file using Shell

    Shell is pretty straight forward. You pass it the correct path and it will run the application. Unless you are ready to start showing the code you are using then I can't recommend anything further.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Re: Getting error trying to open .exe file using Shell


  10. #10
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Getting error trying to open .exe file using Shell

    Since the username is Administrator, I would check and see if you have read and execute permissions for that directory.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Re: Getting error trying to open .exe file using Shell

    even if i try to create a shortcut of the .exe on the desktop and run it, it says file not found.

  12. #12
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Getting error trying to open .exe file using Shell

    Are you an administrator on the machine?

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Re: Getting error trying to open .exe file using Shell

    yup.

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Oct 2010
    Posts
    195

    Re: Getting error trying to open .exe file using Shell

    i found it. i created a shortcut of the .exe and then using Shell "cmd.exe /c start 1.lnk" it worked. thank you all for the help

  15. #15
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: [RESOLVED] Getting error trying to open .exe file using Shell

    That full path has spaces in it. When Shell() calls WinExec() you're subject to the following:
    Security Remarks

    The executable name is treated as the first white space-delimited string in lpCmdLine. If the executable or path name has a space in it, there is a risk that a different executable could be run because of the way the function parses spaces. The following example is dangerous because the function will attempt to run "Program.exe", if it exists, instead of "MyApp.exe".

    Code:
    WinExec("C:\\Program Files\\MyApp", ...)
    If a malicious user were to create an application called "Program.exe" on a system, any program that incorrectly calls WinExec using the Program Files directory will run this application instead of the intended application.
    The example there is in C, which is why you see the escaped \'s there.


    The point is, your path needs quotes around it, e.g.:
    Code:
    Shell """C:\Documents and Settings\Administrator\Desktop\Life VS Death\...\Air Station.exe"""

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