X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-3.0 required=5.0	tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,TW_RG
X-Spam-Check-By: sourceware.org
Subject: Re: argv @-expansion with pathname containing spaces
Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\))
Content-Type: text/plain; charset=windows-1252
From: Denis Excoffier <cygwin@Denis-Excoffier.org>
In-Reply-To: <CA+sc5mmhQiSseK3279nSW-0xwyODzMUYEY13pb_CJpwD6QTmng@mail.gmail.com>
Date: Thu, 20 Dec 2012 22:34:08 +0100
Cc: cygwin@cygwin.com
Message-Id: <DB2D51D9-47EB-4609-A28E-9FF0FA1E5472@Denis-Excoffier.org>
References: <20121219162048.GA4564@qp9482>	<CAEhDDbDcoiKng6D2zqb-_xKrMUnt_H8Lj7FNPgXnMfis0R9mpw@mail.gmail.com>	<20121220115536.GA300@qp9482> <CA+sc5mmhQiSseK3279nSW-0xwyODzMUYEY13pb_CJpwD6QTmng@mail.gmail.com>
To: Earnie Boyd <earnie@users.sourceforge.net>
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id qBKLYuqd015471

On 2012-12-20, 18:49, Earnie Boyd wrote:
> On Thu, Dec 20, 2012 at 6:55 AM, Denis Excoffier wrote:
>> However i don't see how to
>> derive the 8.3 form from my original filename, using DOS only.
> 
> The /X argument to cmd.exe's dir command will give you the 8.3 name if
> it exists.  Note that your system can be configured to not produce the
> 8.3 form.

I tried 'dir /X %pathname%', or 'dir /X /B %pathname%' (and other combinations),
i can produce "some" 8.3 strings, bug was unable to produce the replacement
of the full path (with 8.3 strings replaced everywhere). And setting the
result in another variable seems another challenge…

On the other hand, i have discovered something funny to calculate the directory
where a bat file is installed:

pushd %0\..
set dirname=%cd%
popd

This seems to work in all situations (spaces in filenames, bat file called through
absolute path or relative path, even the simple foo.bat works…). It also removes
the annoying quotes that are set around %0.

It's a good trick, did anybody know this?


Regards,

Denis Excoffier.

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


