使用参数从CMD调用wscript.exe [英] Call wscript.exe from CMD with parameters

查看:351
本文介绍了使用参数从CMD调用wscript.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用CMD中的参数调用VBScript编译器 WScript.exe ,例如:

Is it possible to call the VBScript Compiler WScript.exe with parameters from CMD, like;

WScript.exe -"WScript.Echo Hello World"



显示一个消息框。

我知道如何使用VBScript但我想运行一个脚本而不保存到 .vbs 档案。



提前致谢



我的尝试:



--------------------------------- --------


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:

-----------------------------------------

推荐答案

WScript.exe不是编译器而是解释器,因为VBScript不是编译的编程语言,而是脚本语言。 />


这个解释器期望第一个参数是脚本的路径并将解释它。你可以添加更多这样的参数:

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:
wcscript.exe test.vbs "C:\temp\"



但你不能省略第一个,这是强制性的!



BTW您也可以使用Script.exe,它与WScript.exe相同,但是一个控制台程序。


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.


这篇关于使用参数从CMD调用wscript.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆