Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-09-12
4
Medium Priority
?
56 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 49

Assisted Solution

by:Martin Liss
Martin Liss earned 1000 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 1000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

730 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