CMD 批处理 选择器

来源:互联网 发布:淘宝推广计划书 编辑:程序博客网 时间:2024/05/21 22:46
@echo off :selectecho         *********************************************************************************************echo         1:开户               2:销户               3:账户冻结               4:账户止入               5:账户止出echo         6:账户解冻           7:账户解除止入       8:账户解除止出                                        rem echo         10:新增科目         11:修改科目                            echo         20:新增分录规则     21:修改分录规则            echo         30:资金冻结         31:资金解冻                echo         40:分录处理                        echo         *********************************************************************************************set /p choice=请输入一个功能代码:if /i %choice%==1 goto runif /i %choice%==2 goto accountif /i %choice%==3 goto accountif /i %choice%==4 goto accountif /i %choice%==5 goto accountif /i %choice%==6 goto accountif /i %choice%==7 goto accountif /i %choice%==8 goto accountif /i %choice%==20 goto runif /i %choice%==21 goto runif /i %choice%==30 goto runif /i %choice%==31 goto runif /i %choice%==40 goto runecho 输入无效请重新输入.goto select:runecho 功能处理开始...start jar.bat  %choice%goto select:accountecho 功能处理开始...set /p id=请输入一个账户的id:start jar.bat  %choice% %id%goto select


调用另外的bat文件如下

java -jar my-spring-app.jar %1 %2exit

外另附上如何用maven构成一个可执行的spring jar包


<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>1.7</version><executions><execution><phase>package</phase><goals><goal>shade</goal></goals><configuration><finalName>my-spring-app</finalName><shadedArtifactAttached>true</shadedArtifactAttached><shadedClassifierName>jar-with-dependencies</shadedClassifierName><transformers><transformerimplementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"><mainClass>com.******.*****.acc.Main</mainClass></transformer><transformerimplementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.handlers</resource></transformer><transformerimplementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.schemas</resource></transformer><transformerimplementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.tooling</resource></transformer></transformers></configuration></execution></executions></plugin></plugins></build>

<mainClass>用来指定程序的入口

用maven的install 命令执行后可生成一个叫 my-spring-app.jar 的包

直接用java -jar my-spring-app.jar 就可以运行了。

0 0