Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6190565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:36:41+00:00 2026-05-24T02:36:41+00:00

I have the following VBScript code: Dim returnVal returnVal = You did not pass

  • 0

I have the following VBScript code:

Dim returnVal
returnVal = "You did not pass me 4 arguments"

args = WScript.Arguments.Count

If args = 4 Then
    returnVal = "The arguements you passed me are " & WScript.Arguments.Item(0) & "  "  & WScript.Arguments.Item(1) & "  "  & WScript.Arguments.Item(2) & "  "  & WScript.Arguments.Item(3) 
end if

All I want is the ability to print “returnVal” so that if I typed:

test.vbs 1 2 3 4

It would return:

The arguments you passed me are 1 2 3 4

How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:36:41+00:00Added an answer on May 24, 2026 at 2:36 am

    To output to the command console window you can do this using:

    WScript.Echo returnVal 
    

    or

    WScript.StdOut.WriteLine returnVal 
    

    But you must use the CScript host for this to work, for example:

    cscript.exe myscript.vbs
    

    WScript is the GUI host and so has no knowledge of the standard input/output/error/aux streams. Trying to do WScript.StdOut.WriteLine will result in the following error dialogue:

    ---------------------------
    Windows Script Host
    ---------------------------
    Script: d:\myscript.vbs
    Line:   12
    Char:   1
    Error:  The handle is invalid. 
    Code:   80070006
    Source:     (null)
    
    ---------------------------
    OK   
    ---------------------------
    

    In a CScript.exe script you can still pop up GUI message dialogues using:

    Msgbox "Hello World!" 
    

    Using WScript.Echo in a WScript host will display the message in a popup dialogue instead of printing to the command line window.

    For more information see:

    Write Method (Windows Script Host)

    For more information on the differences between WScript and CScript and how to switch between them:

    Sesame Script Stop and Go (MS TechNet)

    The difference between Cscript and Wscript is that Cscript is the
    command-line version of the script host and Wscript is the graphical
    version. This difference isn’t really noticeable unless your script
    uses the Wscript.Echo command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following vbscript code that returns the local IP address. It works
I have the following VBScript: Dim strFile, strXPath, strNewText, xmlDoc, xmlNodes, xmlNode strFile =
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section
I have the following VBScript: SET Wmi = GetObject(winmgmts:\\.\root\cimv2) SET QR = Wmi.ExecQuery(SELECT *
I'm trying to run the following VBScript code on a Win2k SP4: strComputer =
i have written following vbScript file to make several programs autostart with delay: 'Delay
I have following code: public class reader extends Activity { WebView mWebView; String mFilename;
I have following code: typedef int (*t_Function) (int x); t_Function Functions[MAX_FUNCTIONS]; int f(int x)
I have following code snippet in c#. var list = new List<string> { a,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.