Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个小的命令行 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"