我有一个小命令行JScript例程,我通常使用Windows中的cscript从命令行运行。我希望能够按照......的方式传递论据。
%:> cscript doSomethingToFile.js FileInQuestion.txt
有关如何做到这一点的任何见解?非常感谢。
我有一个小命令行JScript例程,我通常使用Windows中的cscript从命令行运行。我希望能够按照......的方式传递论据。
%:> cscript doSomethingToFile.js FileInQuestion.txt
有关如何做到这一点的任何见解?非常感谢。
来自伯纳德马克思
xx.js
alert = function(s){WScript.Echo(s)}
var arg = WScript.arguments(0)
alert(arg.toUpperCase() + " now upper case")
...
(假设在C:>提示符下):
C:\> windows\wscript.exe xx.js "apples and bananas"