delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/20/13:24:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Sat, 20 Mar 2004 13:24:05 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Lars Steinke <lars DOT steinke AT tu-clausthal DOT de>
cc: cygwin AT cygwin DOT com
Subject: Re: g77 (new), Windows XP Professional, CALL System(Command, Status), directory.
In-Reply-To: <E1B4l09-0002yv-00@mrelayng.kundenserver.de>
Message-ID: <Pine.GSO.4.56.0403201317560.26885@slinky.cs.nyu.edu>
References: <E1B4l09-0002yv-00 AT mrelayng DOT kundenserver DOT de>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

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 <http://cygwin.com/faq/faq_4.html#SEC36>).  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.
	Igor
P.S. FYI, system("cmd /c cls") won't work on Win9x.
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019