System Command
Kenneth Brody
kenbrody at spamcop.net
Wed Apr 17 08:40:45 PDT 2013
On 4/17/2013 11:34 AM, Brian K. White wrote:
> On 4/17/2013 11:15 AM, Kenneth Brody wrote:
[...]
>> Note, however, that there is a "feature" is the start command that you need
>> to know about if the filename needs to be in quotes. (For example, if the
>> file is "c:\Documents and settings\Richard\temp\foo.pdf".) If you were to
>> execute a command such as:
>>
>> start "c:\path to\filename.pdf"
>>
>> you will get a command prompt with "c:\path to\filename.pdf" as the window
>> title. To prevent this from happening, put a pair of quotes prior to the
>> filename:
>>
>> start "" "c:\path to\filename.pdf"
>>
>
> Forgot about that one.
> God I hate Windows.
> There is some even worse real bizzarro insanity with quoting arguments
> to cmd.exe.
Check out the documentation regarding quotes for:
cmd /c "command to execute"
=====
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
two quote characters
- the string between the two quote characters is the name
of an executable file.
2. 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.
=====
In other words, the following won't work the way you expect:
cmd /c "c:\path to\foo.exe" "c:\path to\whatever.dat" /foobar
--
Kenneth Brody
More information about the Filepro-list
mailing list