Get command line arguments with jscript.net

2020-07-30 02:07发布

None of these work:

var arguments = System.Environment.GetCommandLineArgs();

~

var arguments = Environment.GetCommandLineArgs();

~

var arguments:String[] = System.Environment.GetCommandLineArgs();

~

var arguments:String[] = Environment.GetCommandLineArgs();

it prints JS1135: Variable 'System' has not been declared or error JS1135: Variable 'Environment' has not been declared . Even in MSDN there's no example with jscript. Is is possible to get the arguments in jscript.net ?

1条回答
我欲成王,谁敢阻挡
2楼-- · 2020-07-30 02:54

This works:

import System;

var arguments:String[] = Environment.GetCommandLineArgs();
print(arguments[0]);
print(arguments[1]);

Though the arguments[0] is always the name of the compiled/called .exe file.

查看更多
登录 后发表回答