Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Reply-To: From: "Ross Boulet" To: , "'Lars Steinke'" Subject: RE: g77 (new), Windows XP Professional, CALL System(Command, Status), directory. Date: Tue, 23 Mar 2004 15:34:49 -0600 Message-ID: <002c01c4111e$ad70abf0$6501a8c0@RossLap> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: X-IsSubscribed: yes > -----Original Message----- > From: cygwin-owner On Behalf Of Igor Pechtchanski > Sent: Monday, March 22, 2004 7:12 AM > > On Mon, 22 Mar 2004, Lars Steinke wrote: > > > >On Sat, 20 Mar 2004, Lars Steinke wrote: > > > > > >> Hello, > > >> > > >> call system('cmd.exe /c cls') > > >> > > >> works! Thank you Dave! > > >> > > >> Now I have a new problem with 'call system': > > >> I wolud like to start a batch-file named '1.bat'. > > >> 1.bat and my program are in the same directory (C:\test). > > >> > > >> call system('1.bat') > > >> pause > > >> end > > >> > > >> Error-message: > > >> > > >> 1.bat: not found > > >> > > >> If i add the directory to the PATH: > > >> > > >> PATH=%PATH%;C:\test > > >> > > >> it works, but normally the current directory should be > scanned, also if > > >> it is not in the PATH...? > > >> > > >> If I try to start my program from the cygwin-shell > (current directory is > > >> the directory where the program is saved) i get the following > > >> error-message: > > >> > > >> bash: a.exe: command not found > > >> > > >> This is no 'call system'-problem, but mayby there is a > correllation. > > >> > > >> Thank you very much, Lars. > > > > > >Lars, > > > > > >In Cygwin, like in most Unixes, and unlike Windows, "." > (the current > > >directory) has to explicitly be in the PATH for programs > to be found there > > >(see ). As the > FAQ says, you can > > >prepend "./" to the name of the program in the current directory. > > >Alternatively, you can add "." to the PATH, either in your > environment, or > > >via a "putenv" call if FORTRAN supports it. > > > > Ok, but I have the same situation in Windows and in windows > normally the "." should be scanned, also if it is not in the PATH. > > If my program tries to invoke 1.bat (Win-shell) it fails > (1.bat: not found), although it is in the same directory (and > it is not a builtin command). > > If I try to compile: > > > > CALL System('.\1.bat') > > > > ?.bat: not found > > > > > > CALL System('cmd.exe /c 1.bat') works, but 1.bat is > not a builtin command...? > > > > > > >P.S. FYI, system("cmd /c cls") won't work on Win9x. > > > > Is there a command which fits both? > > Thanks, Lars. > > Wrong slash. Try > > CALL System('./1.bat') > > As for Win9x, they use "command.com", not "cmd.exe"... I > doubt there's a > command that'll do both (unless you get the value of the COMSPEC > environment variable and use that)... You can also use the "clear" > command (in the "clear" package). > HTH, > Igor This is probably way OT for this list, but AFAIK, command.com continues to be provided on Windows, so CALL System('command.com /c 1.bat') Might work from Windows 9x all the way to 2003 Server. Ross -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/