www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/12/15/06:20:23

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5BFBKNQH3028128
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 5BFBKNQH3028128
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=xB+IExtH
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40B994BA23E0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1765797622;
bh=roDH+G1QDvZi5qBdLWvkB4a9ybiLvgcTJ2ZHIK8hIfI=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=xB+IExtHJ2DOImhLStTHxXHz6btmfkCIWQDwHZlTRtOSkgRQ0p2OgnqrP+Vw+YoGk
uxChLSxIqm0fgILSwroS1eGj6LqluJGreFYPOE8dABFVPep68R65KaazEs7TsKKNKy
5VJfEitJ8eDH3xDWfbWRxAXC8FXkJNBTcyx1zXdQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6BCD84BA2E20
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6BCD84BA2E20
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765797603; cv=none;
b=v3uuASbqtGwPmXtAH7mrQhfd2Ue2PLX6QgsX822FVZhKJr0WkVy5qgclFBK/4sMtQkhEd6X6d/IZNUcbmAhiFVLK/aYTl9VLILPgmdkhs12t24FWD+8DbYyLOpbCPRjlkX0X+6930IYovpavV2XU5OR2J4cWMc+PJ8D1BSBEens=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1765797603; c=relaxed/simple;
bh=2NLluKYDixaJRtwSa2q5uMQU0Ld+79+A+VWyCiR9AI0=;
h=DKIM-Signature:Date:From:Message-ID:To:Subject:MIME-Version;
b=DGxFyiY41R5xWd24z6m0a6axcJu43ZGToz4EGad/0UOpZ4771/XmJvL9QLH8JOm+PKCeVVQ1gUK6M39XUt0wRLR2W62Ghnc48o/M9KTe+4+vKtBAhfI2KFMOzecSE81L3U85I2BtOdJGgmtcXMQdcvGG8Kyt5zpigDSFHqws+cg=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BCD84BA2E20
X-Yandex-Fwd: 1
Date: Mon, 15 Dec 2025 14:06:14 +0300
X-Mailer: The Bat! (v11.4.3) Home
Message-ID: <1025745816.20251215140614@yandex.ru>
To: Christian Franke via Cygwin <cygwin AT cygwin DOT com>, cygwin AT cygwin DOT com
Subject: Re: Something wrong with cygstart
In-Reply-To: <4d8b5ba9-ee94-9ca2-4eac-8f0aaab16ef3@t-online.de>
References: <5010206948 DOT 20251214121509 AT yandex DOT ru>
<4d8b5ba9-ee94-9ca2-4eac-8f0aaab16ef3 AT t-online DOT de>
MIME-Version: 1.0
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Andrey Repin via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Andrey Repin <anrdaemon AT yandex DOT ru>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 5BFBKNQH3028128

Greetings, Christian Franke via Cygwin!

> Andrey Repin via Cygwin wrote:
>> I'm using a wrapper script to comfortably start VS Code from file manager.
>>
>> The last line of it is
>>
>> cygstart --hide -- "/proc/cygdrive/c/Program Files/Microsoft VS Code/bin/code.cmd" "$(cygpath -alw "$_arg")"
>>
>> It works well up to the point where there are no spaces in the $_arg. But on
>> the first seen space it break the arguments list into pieces.
>> I have to double-quote the argument to maintain the consistency, like
>>
>> cygstart --hide -- "/proc/cygdrive/c/Program Files/Microsoft VS Code/bin/code.cmd" "\"$(cygpath -alw "$_arg")\""
>>
>> but that's a questionable solution at best.

> This is as expected. Unlike Cygwin's exec() emulation, cygstart does not
> add any quoting during conversion of the argv[] array to the plain argument
> string required for Windows process creation API.

Which is rather surprising, considering I've had these scripts for years.
Guess I was just TOO lucky to not stumble upon the issue sooner.

> Example:

> $ cat test.cmd
> @echo off
> echo %%1 = '%1'>test.txt
> echo %%2 = '%2'>>test.txt
> echo %%3 = '%3'>>test.txt
> echo %%4 = '%4'>>test.txt
> echo %%5 = '%5'>>test.txt

> $ ./test.cmd ArgOne 'Arg Two' 'Arg    Three'; cat test.txt
> %1 = 'ArgOne'
> %2 = '"Arg Two"'
> %3 = '"Arg    Three"'
> %4 = ''
> %5 = ''

> $ cygstart ./test.cmd ArgOne 'Arg Two' 'Arg    Three';\
>    sleep 1; cat test.txt
> %1 = 'ArgOne'
> %2 = 'arg'
> %3 = 'Two'
> %4 = 'Arg'
> %5 = 'Three'

> $ cygstart ./test.cmd ArgOne '"Arg Two"' '"Arg    Three"' ;\
>    sleep 1; cat test.txt
> %1 = 'ArgOne'
> %2 = '"Arg Two"'
> %3 = '"Arg    Three"'
> %4 = ''
> %5 = ''

> $ cygstart ./test.cmd 'ArgOne "Arg Two" "Arg    Three"' ;\
>    sleep 1; cat test.txt
> %1 = 'ArgOne'
> %2 = '"Arg Two"'
> %3 = '"Arg    Three"'
> %4 = ''
> %5 = ''


-- 
With best regards,
Andrey Repin
Monday, December 15, 2025 14:05:03

Sorry for my terrible english...

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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