I have a script. I want to send a line with double quotes inside it to that script, like this: Cscript myScript.vbs "Testing "this line""
But the double quotes inside the line make it so the line never gets to the script properly. I've tried escaping with a carat (^) or using double double-quotes ("Testing ""this line""") with different results, but none is the result I want (the script getting Testing "this line").
To justify why I need to do this, I'm trying to send an SQL line to a script that will edit my Orca table, and there needs to be double quotes in one of the values to do what I want to do with Orca.
You could try this:
Here is the vb script x.vbs:
Wscript.Echo Unescape(Wscript.Arguments.Item(0))
Here is the output for running it:
D:\>cscript x.vbs "Testing %22this line%22"
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Testing "this line"
If you replace all " with %22 you will be able to use this method to pass the double quotes in.
This cannot be done. I have tried everything and the only way to make this work is to designate some string of characters to represent " in your VBS and replace the command line arguments instance of the designated string with ". I picked something that would not likely be a problem :!: was the string i used to represent ".
In my code, I added the following:
strArgu0 = Wscript.Arguments(0)
strOldSTR = Replace(strArgu0,":!:","""")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With