This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]