Re: cmd.exe documentation



> Why can't you "do"
>
> myCommand "Hi there "dude"!"
>
> It works perfectly well for me.
>
> The parser appears to do this: (with quotes)
> If the first character of a token is a double-quote, then the token consists
> of all characters from that opening-quote up to the next double-quote that
> is either at end-of-line or is followed by a separator (space or comma - I
> haven't tested any others) - including the quotes.
>
> %~n (where n is a parameter token-number, 1 to 9) will remove the enclosing
> quotes ONLY.
>
> Depending on how you are processing a token, certain characters may need to
> be escaped with a prefixed caret (^)
>
> HTH

In my tests, if you do:

> myCmd "hi "there" dude"

the parameter comes in as:

hi there dude

I would want it to be:

hi "there" dude

I tried escpaing the quotes with a caret (^):

> myProg "hi ^"there^" dude"

and I got:

hi ^there dude

It almost looks like the caret actually does nothing special at all,
but then the second one is inexplicity lost.

What I'm really looking for is a way to take an arbitrary string (which
may have double-quotes, carets or other puntuation) and somehow pass it
into a program as a single parameter. By way of comparison, in most
Unix shells you could enclose the whole string in single quotes ('),
after replacing any internal single quotes by the sequence: '\''

.



Relevant Pages

  • Re: sed and variables question
    ... expanded, you need double quotes, not single quotes. ... the jumble of single characters after /$pattern/ actually does, ... of text immediatelly before a pattern; ...
    (comp.unix.shell)
  • Weird, Wise or Wacky. (MST character quotes)
    ... Below are listed 10 quotes from characters in MSTed movies. ... The sorcerer "Lodac" to Sir Branden as Lodac reneges ...
    (rec.arts.tv.mst3k.misc)
  • Re: sed and variables question
    ... expanded, you need double quotes, not single quotes. ... the jumble of single characters after /$pattern/ actually does, ... of text immediatelly before a pattern; ...
    (comp.unix.shell)
  • Mandis Quotes (aka retiring """ and )
    ... arbitrary textual matter called "Mandis quotes". ... surround the string by a pair of doubled single quotes. ... of ASCII or Unicode characters, but instead as a sequence of lines ...
    (comp.lang.python)
  • Re: cmd.exe documentation
    ... >> haven't tested any others) - including the quotes. ... > I tried escpaing the quotes with a caret: ... get your environment variables to accept the appropriate values, the parser ... will interpret the special characters inconveniently. ...
    (microsoft.public.windowsxp.general)

Loading