[英]How can I pass java -jar arguments in a batch file?
How can I pass java -jar arguments in a batch file ? 如何在批处理文件中传递java -jar参数? Code below doesn't work:
下面的代码不起作用:
set classpath = c:/users/abc/desktop/project/trunk/.CLASSPATH
java -jar java_file.jar "%classpath%"
( the java jar file needs to take the location of the .CLASSPATH file as the argument ) . (java jar文件需要将.CLASSPATH文件的位置作为参数)。 In my main batch file, classpath variable takes the value depending on which project is checked out from the SVN .
在我的主批处理文件中,classpath变量采用该值,具体取决于从SVN中检出的项目。
Hope my question is clear. 希望我的问题清楚。
That's because your set
command has spaces around the =
. 那是因为您的
set
命令在=
周围有空格。 Remove them and it works. 删除它们,它可以工作。
What you have there now essentially means that an environment variable classpath<SPACE>
is set to the given value which starts with a space. 现在,您所拥有的基本上意味着将环境变量
classpath<SPACE>
设置为以空格开头的给定值。 Therefore, the environment variable %classpath%
(without the space in the variable name) doesn't exist at all. 因此,环境变量
%classpath%
(变量名中没有空格)根本不存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.