重定向没有徽标的WSH脚本

时间:2013-06-28 00:54:04

标签: jscript wsh

我写了一个用于创建CSV文件的jscript脚本。从理论上讲,我应该这样使用它:

myscript>foo.csv

但CSV文件被“Microsoft(R)Windows Script Host Version 5.8等”损坏。标志。

我知道我可以写:

cscript  //nologo myscript>foo.csv

但这会降低生产力和可读性。

你有更好的解决方案吗?

1 个答案:

答案 0 :(得分:2)

cscript /?
Usage: CScript scriptname.extension [option...] [arguments...]

Options:
 //B         Batch mode: Suppresses script errors and prompts from displaying
 //D         Enable Active Debugging
 //E:engine  Use engine for executing script
 //H:CScript Changes the default script host to CScript.exe
 //H:WScript Changes the default script host to WScript.exe (default)
 //I         Interactive mode (default, opposite of //B)
 //Job:xxxx  Execute a WSF job
 //Logo      Display logo (default)
 //Nologo    Prevent logo display: No banner will be shown at execution time
 //S         Save current command line options for this user
 //T:nn      Time out in seconds:  Maximum time a script is permitted to run
 //X         Execute script in debugger
 //U         Use Unicode for redirected I/O from the console

所以使用

cscript //Nologo //S
Command line options are saved.