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

Posted on 2016-09-12
Last Modified: 2016-09-12
Trying to pass variables from our ERP software.
these are the values:

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

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
args(3) contains
args(4) contains TESTDB

args(2) should contain;
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
Question by:BFanguy
  • 2
LVL 46

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.

Author Comment

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

Accepted Solution

David Naulls earned 250 total points
ID: 41795062

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

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


Author Comment

ID: 41795088
three quotes did it. thank you david.

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 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