Solved

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

Posted on 2016-09-12
4
37 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 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.
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

840 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