This is the mail archive of the
mailing list for the Cygwin project.
Re: Problem executing a .bat script in a directory with spaces us ing bash
- From: "Bryant, Neil" <nbryant at wachoviasec dot com>
- To: "'cygwin at cygwin dot com'" <cygwin at cygwin dot com>
- Date: Tue, 14 Sep 2004 17:29:04 -0400
- Subject: Re: Problem executing a .bat script in a directory with spaces us ing bash
> 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
set Parameters="quote this" any /way \you -want
@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.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html