[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?
Re: Getting error trying to open .exe file using Shell
You will need the full path to the EXE
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.
Re: Getting error trying to open .exe file using Shell
Re: Getting error trying to open .exe file using Shell
Can cd return the filepath without save/load? :S
Re: Getting error trying to open .exe file using Shell
Quote:
Originally Posted by
systemous
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.
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?
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.
Re: Getting error trying to open .exe file using Shell
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.
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.
Re: Getting error trying to open .exe file using Shell
Are you an administrator on the machine?
Re: Getting error trying to open .exe file using Shell
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
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:
Quote:
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"""