Brian Dessent <brian <at> dessent.net> writes: > > Interesting function. However, I found that it chokes if the name of > the command to run has spaces, even if they are properly quoted on the > command line, e.g. >
That's interesting. I'm running Win XP and even with your patches I /still/ get an error when a batch file path with spaces is given. Shell quoting hell + cmd.exe quoting hell is enough fun for a whole week! As if that's not enough, I see that (at least on XP) cmd.exe has a /S option to process quotes the "old way": "Otherwise, old behavior is to see if the first character is a quote character and if so, strip the leading character and remove the last quote character on the command line, preserving any text after the last quote character." The "new way" is to preserve (exactly two) quotes in the command string if /all/ of the following five conditions are met: "(1) no /S switch; (2) exactly two quote characters; (3) no special characters between the two quote characters, where special is one of: &<>()@^|; (4) there are one or more whitespace characters between the the two quote characters; (5) the string between the two quote characters is the name of an executable file." I really like it that there /cannot/ be special characters between the quotes, and that there /must/ be whitespace characters between the quotes. (NOT!) I wonder if "executable file" includes batch files? I'll plug away at this some more and see if I can figure something out. -- 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/