Passing variable from CMD to VBS

Posted on 2011-10-14
Last Modified: 2012-05-12
I'm launching a .vbs script by calling it from the command prompt. I'd like for the command prompt to pass a variable to the .vbs file. Is this possible? If so, how?
Question by:Darkejo1
    LVL 9

    Expert Comment

    LVL 14

    Accepted Solution

    In the VBScript part you would add something like this.
    From the batch file you would write out the entry like this...
    wscript my-vb-file.vbs "Test"
    The "Test" is the parameter being passed.
    Dim objArgs
    Set objArgs = Wscript.Arguments
    wscript.echo objArgs(0)

    Open in new window


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
    In this previous article (, we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    746 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

    19 Experts available now in Live!

    Get 1:1 Help Now