• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 66
  • Last Modified:

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

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
BFanguy
Asked:
BFanguy
  • 2
2 Solutions
 
Martin LissRetired ProgrammerCommented:
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
 
BFanguyAuthor Commented:
don't have their code, but i can modify what they pass me like you suggest before sending it off.
will try.
0
 
David NaullsIT ConsultantCommented:
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
 
BFanguyAuthor Commented:
three quotes did it. thank you david.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now