如何在互动的方式形式批处理文件JAR文件输入参数 [英] How to enter parameters in a interactive way form batch file to jar file

查看:133
本文介绍了如何在互动的方式形式批处理文件JAR文件输入参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想运行批处理文件一个jar文件,然后运行这个瓶子后文件,它会开始问例如,它会询问有关插入工作目录和插入的工作目录它会问有关文件名之后的一些问题,它应该寻找在此工作目录中,并在下一步它会询问处理该文件,并...

的方法

我在.bat文件中这样写code

 `@回响
设置工作目录= C:\\ MyResult
设置文件名=的Result.txt
集processingmethod = methodD
CD C:\\ JavaFolder
Java的罐子米亚瓦code.jar%工作目录%%名%% methodD%`

但这些步骤只是运行jar文件,但他们没有通过需要进入下一步骤的参数。

我的问题是有什么办法可以通过使用批处理文件自动执行所有这些步骤?

感谢


解决方案

 关闭@echo
集/ p工作目录=输入工作目录
设置/ p =文件名输入文件名
集/ p processingmethod =输入处理方法
CD C:\\ JavaFolder Java的罐子米亚瓦code.jar%工作目录%%名%% processingmethod%

I want to run a jar file from batch file and then after running this jar file it will start asking some question for example it will ask about inserting working directory and after inserting the working directory it will ask about the name of file it should look for in this working directory and in the next step it will ask about the method of processing this file and …

I have written this code in my .bat file

`@echo off
set "workingdirectory=C:\MyResult"
set "filename=result.txt"
set "processingmethod=methodD"
cd C:\JavaFolder
java -jar myjavacode.jar "%workingdirectory% %filename% %methodD%`

but these steps just run the jar file but they don't pass the arguments needed for going to the next steps.

My question is that is there any way to do all these steps automatically by the use of bat file?

Thanks

解决方案

@echo off 
set /p workingdirectory=Enter working dir
set /p filename=Enter file name
set /p processingmethod=Enter processing method
cd C:\JavaFolder java -jar myjavacode.jar %workingdirectory% %filename% %processingmethod%

这篇关于如何在互动的方式形式批处理文件JAR文件输入参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆