delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/15/06:17:53

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
From: "Atreides" <atreidpub AT netcourrier DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: can't manage to use "windows" command-line (C development)
Date: Sun, 15 Dec 2002 12:21:24 +0100
Message-ID: <GIEFJENNKCILBFAIKBJAMELDEIAA.atreidpub@netcourrier.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
In-Reply-To: <20021215023356.GB4720@redhat.com>

> >I explain : I want to launch "Pilot Install" from envicon.com with a text
> >file (full path included) for parameter. I tried to launch it
> using a cygwin
> >shell, does not work... (argument is not understood by the
> program). From a
> >DOS Box (with properly arranged paths of course) : same thing ...
> >But when I enter the same command-line, as in the DOS Box, in the
> >Start/Execute Panel in the start menu : It works!!!
> >
> >So my question is : is it possible in a C program under cygwin
> (I use gcc),
> >to launch such command lines? (like the "system()" instruction, but for
> >windows).
>
> Yes, it's possible.  Try running "net use", for example.  Most Windows
> command-line tools work fine from a cygwin shell.
> You're not providing enough details to debug the problem, unfortunately.

Hello, you were right, I didn't give enough details (it was 3:00 am for me
:)).
Anyway I resolved my problem :
I wanted to launch something like "C:\Program
Files\Pilot_Install_4.0\Pinstall.exe C:\WINNT\Temp\temp_0123456.txt".
So I tried to translate the path of the exe in cygwin paths, or the path of
the argument, or both, but nothing seemed to work. Finally I understood!!!
The program needs a DOS path, even if it is launched through cygwin. And ,
Here is the tricky thing, the argument is parsed by cygwin, so :
"/cygdrive/c/Program\ Files/Pilot_Install_4.0
c:\WINNT\Temp\temp_0123456.txt" does not work
But "/cygdrive/c/Program\ Files/Pilot_Install_4.0
c:\\WINNT\\Temp\\temp_0123456.txt" WORKS!!
The "\\" are interpreted by Cygwin as "\" and are needed for Cygwin to pass
an "understandable" path to windows.

And trickier, I use several strings in my program to build this command
line, and so, there is a second interpretation of the string. So the string
I must use to build this command line is :
"c:\\\\WINNT\\\\Temp\\\\temp_0123456.txt"

Anyway thanks for help.

Nicolas DUTEIL


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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