Title: Message
The problem occurs at real TCL -- i.e. it's a UV problem, not an SB one
However, "NET USER" is obviously smart enough to handle the problem with its parameters
To illustrate:
1) Create a simple DOS batch file called "dsp.bat", in C:\tmp on your UV server
     It contains only this:-
        echo args(0) : %0
        echo args(1) : %1
        echo args(2) : %2
        echo args(3) : %3
        echo args(4) : %4
2) From a real TCL prompt, do as you suggested:-
>DOS /c "c:\tmp\dsp.bat -a:aaa -b:"bb bb" -c:ccc"
args (0) : c:\tmp\dsp.bat
args (1) : -a:aaa
args (2) : -b:" bb bb "
args (3) : -c:ccc
args (4) :
Notice that the second parameter is received by the DOS program as "<space>bb<space>bb<space>", i.e. it has suddenly grown extra leading and trailing spaces. !!!  :-(
[Apparently NET USER doesn't get too confused by this, but not all programs are so robust]
Also notice how intuitively obvious it is that the pair of double quotes inside the string are being passed on to DOS rather than being interpreted as being matched with the outside pair of double quotes as they would be every where else in UV!!!
BTW, if you change it to what would be more intuitive to a UV programmer, with single quotes 'outside' the double quotes ...
>DOS /c 'c:\tmp\dsp.bat -a:aaa -b:"bb bb" -c:ccc'
args (0) : c:\tmp\dsp.bat
args (1) : -a:aaa
args (2) : -b:\"bb bb\"
args (3) : -c:ccc
args (4) :
The double quotes get 'escaped' as <backslash><double quote>
Or if you do it the other way round, single quotes inside doubles, this happens:-
>DOS /c "c:\tmp\dsp.bat -a:aaa -b:'bb bb' -c:ccc"
args (0) : c:\tmp\dsp.bat
args (1) : -a:aaa
args (2) : -b:'bb
args (3) : bb'
args (4) : -c:ccc
Hope this clarifies things 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Stuart Boydell
Sent: Thursday, 29 January 2004 12:31 p.m.
To: U2 Users Discussion List
Cc: SB Solutions
Subject: RE: command shell quoting [was:UNCLASSIFIED RE: mkdbfile: create file in another account]

A question: does this quote mangling behaviour occur at real TCL or just from an SB+ SH.SHELL prompt. The SH.SHELL mangles double quotes - so that may be your problem.
Note that the double quotes work without nesting or escaping them in the following command (tested on UV10.0.4 & 10.0.10):
DOS /C "NET USER anuser anuserpassword /ADD /FULLNAME:"an user" /COMMENT:"an application user." /HOMEDIR:E:\uvaccounts\anaccount"
The information contained in this Internet Email message is intended for the addressee only and may contain privileged information, but not necessarily the official views or opinions of the New Zealand Defence Force.  If you are not the intended recipient you must not use, disclose, copy or
distribute this message or the information in it.  If you have received this message in error, please Email or telephone the sender immediately.
u2-users mailing list

Reply via email to