Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
1.80/5 (3 votes)
See more:
Is it possible to call the VBScript Compiler WScript.exe with parameters from CMD, like;
VB
WScript.exe -"WScript.Echo Hello World"

to display a message box.
I know how to use a VBScript but i want to run a script without being saved to a .vbs file.

Thanks in advance

What I have tried:

-----------------------------------------
Posted
Updated 1-Jun-17 4:01am
Comments
Richard MacCutchan 1-Jun-17 9:13am    
Why don't you try it before posting such a question?
[no name] 1-Jun-17 9:27am    
I have! Is it you who downvoted?
Richard MacCutchan 1-Jun-17 9:29am    
I was thinking "what does this question mean"?
[no name] 1-Jun-17 9:32am    
The question is straightforward, if you're bored or don't have the idea you don't need to reply. This question is a good one, so no need to downvote, ok.
Dave Kreskowiak 1-Jun-17 10:08am    
I down-voted it because you could have easily answered this yourself just by trying it!

Reading the documentation or just running "WSCRIPT /?" would have also given you the answer.

1 solution

WScript.exe is not a compiler but an interpreter because VBScript is not a compiled programming language but a script language.

This interpreter expects as the first parameter the path to script and will interpret it. You can add further parameters like this:
VB
wcscript.exe test.vbs "C:\temp\"

But you can not omit the first one, it's a mandatory one!

BTW you can use Script.exe as well, it is the same like WScript.exe but a console program.
 
Share this answer
 
v4
Comments
[no name] 1-Jun-17 10:09am    
Yea it's an interpreter of course.
Even though i was hoping for a way to run a script from memory, i see know that it is impossible. Thanks for your answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900