Solved

need to know how to pass variable with a semicolon within the value from vbscript to vbs

Posted on 2016-09-12
4
25 Views
Last Modified: 2016-09-12
Trying to pass variables from our ERP software.
these are the values:
ORDER_ID = "TEST"
CONTACT_EMAIL = "BBunny@testthis.com; EFudd@testthis.com"
DATABASE = "TESTDB"

This is the code I am trying:
dim shell
set shell = createobject("WSCRIPT.SHELL")
shell.Run """\\CT01\Root\Visual\Scripts\VMPURENT_Email_800.vbs"" """ & "" & """ " & ORDER_ID & " " & CONTACT_EMAIL & " " & DATABASE & " " & USER & " " & fname & " " & "0",,false

Open in new window


\\CT01\Root\Visual\Scripts\VMPURENT_Email_800.vbs
Dim args
Dim Shell
set args = Wscript.Arguments
if args.count = 0 then wscript.quit
MSGBOX "0 Position: " & args(0) & "  1 ID: " & args(1) & "  2 Email: " & args(2) & "  3 Database: " & args(3) & "  4 User: " & args(4) & " 5 first name: " & args(5) & " 6 downs: " & args(6)

Open in new window


agrs(1) contains TEST
agrs(2) contains BBunny@testthis.com
args(3) contains EFudd@testthis.com
args(4) contains TESTDB

args(2) should contain BBunny@testthis.com; EFudd@testthis.com
args(3) should contain TESTDB

what do I need to do to pass a variable that contains a semicolon to another vbs program using shell
0
Comment
Question by:BFanguy
  • 2
4 Comments
 
LVL 45

Assisted Solution

by:Martin Liss
Martin Liss earned 250 total points
ID: 41795003
Do you have control of the code for the other program? If so in the sending program Replace the semicolon with something else that is not likely to be used (like the pipe "|" symbol), and in the receiving program Replace the pipe with a semicolon.
0
 

Author Comment

by:BFanguy
ID: 41795026
don't have their code, but i can modify what they pass me like you suggest before sending it off.
will try.
0
 

Accepted Solution

by:
David Naulls earned 250 total points
ID: 41795062
BFanguy,

You just need to enclose the Contact_Email variable with triple double-quotes in your shell.run statement as follows:

shell.Run """c:\temp\test.vbs"" """ & "" & """ " & ORDER_ID & " """ & CONTACT_EMAIL & """ " & DATABASE & " " & USER & " " & fname & " " & "0",,false

Cheers
0
 

Author Comment

by:BFanguy
ID: 41795088
three quotes did it. thank you david.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now