Date: Sat, 20 Oct 2001 12:15:34 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Geoff Cox Message-Id: <1659-Sat20Oct2001121534+0200-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: <7se2ttccpk5u9g6223hmp6jvl9c17m15lo@4ax.com> (message from Geoff Cox on Sat, 20 Oct 2001 09:00:38 GMT) Subject: Re: hwo to run prog using "program files" etc ?? References: <7se2ttccpk5u9g6223hmp6jvl9c17m15lo AT 4ax DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Geoff Cox > Newsgroups: comp.os.msdos.djgpp > Date: Sat, 20 Oct 2001 09:00:38 GMT > > I am trying to run jre.exe which is in c:\program files etc but > following compiles OK but when runs comes up with "bad command or file > name" under Windows 98(SE) - any suggestions please? > > #include > > int main() > { > > char *call = "c:\\program files\\javasoft\\jre\\1.1\\bin\\jre.exe"; > system(call); The string you pass to `system' should be the same string you would type at the DOS prompt, including any required quote characters. In this case, since `Program Files' includes a blank, it needs to be surrounded by quotes. So you should use the following string in your program: char *call = "\"c:\\program files\\javasoft\\jre\\1.1\\bin\\jre.exe\"";