Skip to main content
GameDev.net gamedev.net
🔒 Locked

Execute an executable, under XP

Started by Raduprv Feb 25, 2003 at 6:26 PM 8 replies 100+ views
Original Post
Raduprv
Raduprv
I have this problem... I want to execute IE, with the system(); command. So, I tried this: "c:\program files\wherever ie is\iexplore.exe" "http://www.myurl.com" It works fine on 98, but XP complains that can''t execute "c:\program So, any ideas how can I do that? The reason I use system(); is because my game has to work both under Linux and Windows... Thanks in advance. Height Map Editor | Eternal Lands | Fast User Directory
niyaw
niyaw
system("\"c:\\program files\\wherever ie is\\iexplore.exe\" \"http://www.myurl.com\"");
darookie
darookie
It''s all about the ''"'', not the escapes.
Under NT-based operating systems (Win NT, 2000, XP, ...) you need to wrap paths that contain spaces into quotation marks.
I''m pretty sure your config file doesn''t include them:

config.txt:
"c:\program files\path to ie\iexplore" "target url"


Beer Hunter
Beer Hunter
system("start http://myurl.com/"); certainly works for console programs under 98 (and uses the default browser, rather than assuming IE).
I can''t speak for other versions of Windows - but give it a try.
Raduprv
Raduprv
quote:
Original post by darookie
It''s all about the ''"'', not the escapes.
Under NT-based operating systems (Win NT, 2000, XP, ...) you need to wrap paths that contain spaces into quotation marks.
I''m pretty sure your config file doesn''t include them:

config.txt:
"c:\program files\path to ie\iexplore" "target url"



When I said that I send this string "c:\program files\path to ie\iexplore" "target url" I actually meant sending it with QUOTE MARKS, and yes, it is with quotemarks in the ini file.
Anywa, to make sure I don''t have a bug in my program, I pasted that exact string to the command prompt, in XP, and it gave me that error.
As for ShellExecuteEx, that doesn''t work on Linux, and also opens the URL in the last window, not in a NEW window.



Height Map Editor | Eternal Lands | Fast User Directory
darookie
darookie
quote:
Original post by Raduprv
[quote]Original post by darookie
It''s all about the ''"'', not the escapes.
Under NT-based operating systems (Win NT, 2000, XP, ...) you need to wrap paths that contain spaces into quotation marks.
I''m pretty sure your config file doesn''t include them:

config.txt:
"c:\program files\path to ie\iexplore" "target url"



When I said that I send this string "c:\program files\path to ie\iexplore" "target url" I actually meant sending it with QUOTE MARKS, and yes, it is with quotemarks in the ini file.
Anywa, to make sure I don''t have a bug in my program, I pasted that exact string to the command prompt, in XP, and it gave me that error.
As for ShellExecuteEx, that doesn''t work on Linux, and also opens the URL in the last window, not in a NEW window.



Height Map Editor | Eternal Lands | Fast User Directory
Sounds quite unusual. Though I cannot test it with WinXP, it works fine with Win2K.
Try the following:

Open a shell using "cmd".
In the prompt type "Pr" and then hit the TAB key.
Enter the first few letters of your IE path and hit TAB again.
The full path to IE should appear in quotation marks.
If it doesn''t, something''s wrong with your console settings.
(This works for Win2K, too, but only if you have TweakUI installed and activated this feature)

Raduprv
Raduprv
Ok, I did some more tests.
if I pass this string to the command prompt:
"c:\Program Files\Internet Explorer\iexplore.exe"
it works fine.
If I pass:
"c:\Program Files\Internet Explorer\iexplore.exe" "http://someurl" then it complains about not finding IE exe...
If I pass: "c:\Program Files\Internet Explorer\iexplore.exe http://someurl" it also complains...

Height Map Editor | Eternal Lands | Fast User Directory
niyaw
niyaw
try spawn family of functions.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.