Re: How to include a double quote in an argument



Yeah, I've asked Eric Lippert about this before, and he told me after
looking through the command parser that double quotes are not preserved.

You have to write your own escape sequence for double quotes. I've been
using `` (two backquotes) myself.

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:%23uwZnnU$FHA.3872@xxxxxxxxxxxxxxxxxxxxxxx
asa wrote:
> I'm trying to pass a named argument that includes spaces and double
> quotes in the argument itself in a wsf script. Since the argument
> contains spaces, I have to enclose it in double quotes. I tried
> doubling up the double quotes, but it didn't work.
>
> I tried this:
> "echo ""wc -l F9999.txt > F999audit.txt "" "
>
> The argument was stripped of all quotes when assigned to a variable:
> sCommandTxt = colNamedArgs.Item("C")
> How do I keep the quotes?


Not posible - w/cscript host parsing of script arguments and population of
the Arguments (or .Named or .Unnamed) collections does not preserve the
enclosing quotes and no syntax for escaping them when passed is supported,


--
Michael Harris
Microsoft MVP Scripting





.



Relevant Pages

  • Applescript and Autoformat (search and replace), Word 2004
    ... script that will take care of a recurring editing issue with nested ... quotes to double quotes, ... set oldauto2 to auto format as you type replace quotes ... set auto format as you type replace quotes to false ...
    (microsoft.public.mac.office.word)
  • Re: Accessing full command line or parameters WITH QUOTES
    ... The problem is that VBScript doesn't allow access to the full command line ... rebuild the parameters with the quotes inserted properly. ... When I was writing the script on XP, I managed to cheat and grab the ...
    (microsoft.public.scripting.vbscript)
  • Re: Database/Email Script
    ... Both double and single quotes work for quoting array indexes. ... the relevant code. ... What I would like first would be to get the script working. ... task as a learning experience.) ...
    (comp.lang.php)
  • Re: Interesting Discussion with my PHP Teacher
    ... ## For a small script like this one, ... > it wher the sql statement is constructed because there are too many quotes. ...
    (comp.lang.php)
  • Re: basic help to run an application from WSH
    ... string values must be enclosed in quotes. ... The Run method will execute on c:\notepad.exe. ... I'm just learning vbscript for wsh and here is my first script, ... Also if I cut and paste the exact file path from the script into the ...
    (microsoft.public.scripting.vbscript)