简体   繁体   English

Windows:如何从外部文件读取命令行选项?

[英]Windows: How to read command-line options from external file?

javac.exe provides a mechanism to read arguments from external files ( @argfile ). javac.exe提供了一种从外部文件@argfile读取参数的机制。 java.exe does not provide this mechanism. java.exe不提供此机制。

Is there a generic mechanism for getting Windows to read some of the command-line options from an external file (and others from the normal command-line) in order to emulate the same behavior for java.exe ? 是否存在使Windows从外部文件中读取某些命令行选项(从正常命令行中读取其他命令行选项)以模拟java.exe相同行为的通用机制?

Not a one-liner, but the following should do the trick: 不是单线的,而是以下方法可以解决问题:

SET /P ARGS=<foo.txt
java -someArgs %ARGS% -moreArgs

See also Batch equivalent of Bash backticks . 另请参见等效的Bash反引号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 命令行选项可在Windows中使用,但不适用于Linux - Command-line options working in windows, but not Linux 如何从命令行作为参数输入的文本文件中读取逗号分隔的字符串? - How do I read in comma separated string from text file that is inputted from command-line as argument? 如何将命令行输入文件中的行打印到命令行输出文件? - How do I print lines from a command-line input file to a command-line output file? 从命令行传递Maven编译器选项 - Passing Maven Compiler Options From The Command-line 从命令行运行 java 时如何创建自定义选项 - How to create custom options when running java from command-line 如何让我的程序接受 Java 中的命令行选项? - How to make my program accept command-line options in Java? 如何添加自定义 Java 命令行选项? - How to add custom Java command-line options? 如何从命令行使用jarjar? - How to use jarjar from the command-line? 如何在MS Windows中使用命令行将TXT文件添加到WAR存档 - How to add TXT file to the WAR archive using command-line in MS Windows 从Windows命令行运行时如何请求JVM垃圾回收(而不是代码) - How to request JVM garbage collection (not from code) when run from Windows command-line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM