2

I am a newbie in the programming. I am wondering what the difference is between below two method of kicking off a VBScript. Both of them work on my machine.

call "C:\script.vbs"

cscript "C:\script.vbs"

lovechillcool
  • 762
  • 2
  • 10
  • 32

1 Answers1

2

Usually, people compare cscript with wscript, the difference is explained here:

Difference between wscript and cscript

"Call" calls one batch program from another without stopping the parent batch program.

https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/call.mspx?mfr=true

CALL command vs. START with /WAIT option

In Windows, if you are running an automated program written in several batch scripts, you'll want to use "call".

Community
  • 1
  • 1
Frank Zhang
  • 509
  • 2
  • 7
  • I understand both pairs, wscript/cscript and call/start; but my question is whether there is a different between call script.vbs and cscript script.vbs – lovechillcool Mar 11 '15 at 03:08
  • 1
    @lovechillcool OK, if so, based on my knowledge, if there is a message box in your vbs (e.g.: wscript.echo("OK")), using call will show a windows message box, using cscript will show the message in the parent console. – Frank Zhang Mar 11 '15 at 03:31
  • 1
    It should be noted that this is basically because call will use the default scripting host which is wscript not because call does that. call on something different than a batch is more or less the same as not using call – Syberdoor Mar 11 '15 at 07:13
  • And also, if use cscript, ugly header would show up so I used `cscript //nologo` to suppress it; call doesn't show the header in the first place. – lovechillcool Mar 11 '15 at 14:26