Display VBS variable in command prompt

40,006

Use WScript.Echo:

For i = 0 To 10
  WScript.Echo i
Next

You'll want to use CSCRIPT, either explicitly:

cscript vecho.vbs

Or make CSCRIPT the default:

cscript //H:CScript
Share:
40,006
Tjs
Author by

Tjs

Updated on January 24, 2020

Comments

  • Tjs
    Tjs about 4 years

    I would like to know how to display variable values in command prompt. Following is the vbs code:

     For i=0 To 10
     // I should display this variable value in command prompt
     Next
    

    If I write Shell.run(a.bat) inside loop, this will open command prompt 10 times.
    But i want all 10 values to be displayed in single command prompt.

  • Tjs
    Tjs about 11 years
    Nothing. I just converted host from wscript to cscript and used WScript.Echo command. I called VBS file from Bat file so that everything got displayed in Command prompt :) Thank you