delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/14/17:29:13

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Message-ID: <EB0CB9EA028CD411B36300508BADE2AA0A384CC4@vanpgv1twfa03.ntserver.fub.com>
From: "Bryant, Neil" <nbryant AT wachoviasec DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Re: Problem executing a .bat script in a directory with spaces us ing bash
Date: Tue, 14 Sep 2004 17:29:04 -0400
MIME-Version: 1.0
X-OriginalArrivalTime: 14 Sep 2004 21:29:05.0289 (UTC) FILETIME=[DC7E3F90:01C49AA1]

> I'm not sure how Sean is trying to launch the batch file (ie, 
> from a batch file, or compiled executable, etc) so how you 
> would get a sfn would vary (and I can only really speak on 
> the Win side), but if you know the batch exists, [cygpath -d 
> "path\file.bat"] should give it in a usable manner.

PS, Sean, since I have it open at the moment, I pass this on to you;

On the chance that you are calling your batch files from batch files (which
is probably the hardest to get a short file name in), and that you are
running NT, the following might help you.

The following two lines are essentially equivalent in Batch; except that the
second will shorten the file name for the batch file -- oddly enough,
leaving the unquoted parameters intact (though, probably not in all
situations).
============================================================================
=========================
set Parameters="quote this" any /way \you -want
%USERPROFILE%\doit.bat %Parameters%
@for %%x IN ("%USERPROFILE%\doit.bat") DO %%~fsx %Parameters%
============================================================================
=========================
The first line breaks under most conditions at the first space. The second
one is pretty resiliant. It will shorten even nonexistant filenames (though
it will only shorten the existing part), and you can use "DO" or "DO CALL"
as you wish.

HTH,

~Neil

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