Arguments : Passing Arguments containing <"> 
Author Message
 Arguments : Passing Arguments containing <">

I Need to pass an Argument containing chr(34) " to a VBScript like:
xpto(123)"abc
If I use W95 I can escape the Chr(34) using \ like xpto(123)\"abc and
it works fine
but if I use WNT4 it sould work with ^ for escape like xpto(123)^"abc
but it doesn't work.

I'm Reading the args through WScript.Arguments.Item(1)

Any Ideas Why? and workarounds ?

I'm using Vbscript 5.0 Build 3715

s1="Your script engine version is " & scriptengine & vbcrlf
s1=s1 & "Your script engine major version is " &
scriptenginemajorversion & vbcrlf
s1=s1 & "Your script engine minor version is " &
scriptengineminorversion & vbcrlf
s1=s1 & "Your script engine build version is " &
scriptenginebuildversion & vbcrlf

msgbox(s1)



Mon, 25 Feb 2002 03:00:00 GMT  
 Arguments : Passing Arguments containing <">

Because of the way that WScript/CSript parse the command line, I've never found a way to pass a " as part of an argument.  There is a way to cheat, though - use 2 single quotes to represent one double quote and use the replace function on each argument...

set args = wscript.arguments
Redim myArgs(args.count-1)
for n = 0 to args.count-1
  'replace doubled single quotes with
  'a single double quote...
  myArgs(n) = replace(args(n),"''","""")
next
for each arg in myArgs
  msgbox arg
next

--
Michael Harris


  I Need to pass an Argument containing chr(34) " to a Vbscript like:
  xpto(123)"abc
  If I use W95 I can escape the Chr(34) using \ like xpto(123)\"abc and
  it works fine
  but if I use WNT4 it sould work with ^ for escape like xpto(123)^"abc
  but it doesn't work.

  I'm Reading the args through WScript.Arguments.Item(1)

  Any Ideas Why? and workarounds ?

  I'm using Vbscript 5.0 Build 3715

  s1="Your script engine version is " & scriptengine & vbcrlf
  s1=s1 & "Your script engine major version is " &
  scriptenginemajorversion & vbcrlf
  s1=s1 & "Your script engine minor version is " &
  scriptengineminorversion & vbcrlf
  s1=s1 & "Your script engine build version is " &
  scriptenginebuildversion & vbcrlf

  msgbox(s1)



Mon, 25 Feb 2002 03:00:00 GMT  
 Arguments : Passing Arguments containing <">
On Thu, 9 Sep 1999 09:50:23 -0700, "Michael Harris"

Quote:

>Because of the way that WScript/CSript parse the command line, I've =
>never found a way to pass a " as part of an argument.  There is a way to =
>cheat, though - use 2 single quotes to represent one double quote and =
>use the replace function on each argument...

>set args =3D wscript.arguments
>Redim myArgs(args.count-1)
>for n =3D 0 to args.count-1
>  'replace doubled single quotes with=20
>  'a single double quote...
>  myArgs(n) =3D replace(args(n),"''","""")
>next
>for each arg in myArgs
>  msgbox arg
>next

Thankx anyhow, but it doesn't work under NT either.
Still need some help on this behaviour under NT


Fri, 01 Mar 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. <<<<<<<<ComboBox>>>>>>>>>>>>

2. Passing Arguments through "OnAction"

3. --------<<<<<<MONEY>>>>>>--------- id 9543

4. HELP >>>>>>WIN API <<<<<<<<<<

5. Access to WSF <named> argument attributes

6. VB->C++DLL argument passing mystery [QUESTION]

7. Crystal Report 8 causes error <font color="blue"><B>20599</B></font>

8. help me out please!!!!<<<<<<<<<<<<<<<<<<<<<<<thanks>>>>>>>>>>>>>>>>>>>>>>>>

9. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

10. <<<<HELP- OLE container Control>>>>>>>>>

11. Arguments pass short 8.3 filename, how pass LFN?

12. Passing Arguments / Passing an Array

 

 
Powered by phpBB® Forum Software