Use windows batch script to create menu
Background
Recently, I find that we need to type some very long gradle commands to run build, check, test, etc. It's very annoying, isn't it?
Idea
Can I write a script to run the gradle commands? Is that easy? If so, I only need to type 2 or 3 charactors(like "go" or "go 1") in this way. Considering we are working with windows 7, so I choose windows batch script to make my dream come true. ^_^
Solution
Step 1: display a menu in the command line
@echo off
::file name: go.bat
::##################Menu##################
:menuLoop
echo Task List
echo 1 Local build (clean build)
echo 2 Quick check (clean check -x :integrationTest ...)
echo 3 Intellij config (--refresh-dependencies cleanIdea idea)
set choice=
echo.&set /p choice=Choose one task or hit ENTER to quit: ||(goto :EOF)
echo.&call :task_%choice%
goto :EOF ::##################Tasks##################
:task_1
call gradle clean build
goto :EOF :task_2
call gradle clean check -x :integrationTest -x :coberturaIntegrationTest
goto :EOF :task_3
call gradle --refresh-dependencies cleanIdea idea
goto :EOF
Step 2: accept one parameters
::#################Accept Parameters#################
::set option=%1
if "%1" == "" (
goto :menuLoop
) else (
goto :task_%1
)
Put this part before the menu codes, then it should work.
OK, now I only need to type "go 2" if I want to do a quick check on my project codes.
NOTE: some tasks in the batch script above were written based on our project requirements. You need to make some changes about the commands.
Use windows batch script to create menu的更多相关文章
- Windows Batch 编程 和 Powershell 编程
Batch Script - Functions with Return Values https://www.tutorialspoint.com/batch_script/batch_script ...
- 深入浅出Windows BATCH
1.什么是Windows BATCH BATCH也就是批处理文件,有时简称为BAT,是Windows平台上的一种可运行脚本,与*nix(Linux和Unix)上的Shell脚本和其它的脚本(Perl, ...
- CCNET+ProGet+Windows Batch搭建全自动的内部包打包和推送及管理平台
所要用的工具: 1.CCNET(用于检测SVN有改动提交时自动构建,并运行nuget的自动打包和推送批处理) 2.ProGet(目前见到最好用的nuget内部包管理平台) 3.Windows Batc ...
- Windows batch,echo到文件不成功,只打印出ECHO is on.
jenkins 执行Windows batch command的时候,如果想要读写文件,echo到文件不成功. bat 代码如下: set ctime=%date%_%time% echo %ctim ...
- Use Windows Azure AD to create SSO projects
Keywords Windows Azure AD, SSO Summary Use Windows Azure AD to create SSO projects Detailed Scenario ...
- windows batch语法
windows BATCH基本知识扩展名是bat(在nt/2000/xp/2003下也可以是cmd)的文件就是批处理文件. ==== 注 =============================== ...
- [Windows Azure] How to Create and Deploy a Cloud Service?
The Windows Azure Management Portal provides two ways for you to create and deploy a cloud service: ...
- jenkins 如何处理windows batch command
这两天一直被一个问题困扰. 在jenkins的windows batch command 测试好的,拿到bat文件中,再从Execute Windows Batch command 中调用这个bat, ...
- Build step 'Execute Windows batch command' marked build as failure
坑爹的Jenkis,在执行windows命令编译.NET项目的时候命令执行成功了,但是却还是报了这样一个错: Build step 'Execute Windows batch command' ma ...
随机推荐
- Ubuntu16.04.1 安装Redis-Cluster
Redis在3.0版正式引入了集群这个特性.Redis集群是一个分布式(distributed).容错(fault-tolerant)的 Redis内存K/V服务, 集群可以使用的功能是普通单机 Re ...
- jeecms子栏目或者文章页导航父栏目选中解决方法
jeecms在子栏目或者文章页导航父栏目选中,看例子 <div class="nav"> <ul> [@cms_channel_list ] <li ...
- Laravel 5 基础(二)- 路由、控制器和视图简介
查看 app/Http/routes.php Route::get('/', 'WelcomeController@index'); @是一个界定符,前面是控制器,后面是动作,表示当用户请求url / ...
- Hibernate 插入,修改,删除,查询语句
/* *具体操作hibernate的类 *增加,删除,修改,按ID查询,模糊查询,查询全部 **/ public class PersonOperate { //在hibernate中所有操作都是由S ...
- python操作mysql之pymysql
pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb几乎相同.但目前pymysql支持python3.x而后者不支持3.x版本. 本文测试python版本:2.7.11.mys ...
- WPF 在画布中布局N行N列的实现方法
最近写一个WPF项目,中间有一个实现在画布中排列的问题(整齐摆列几行几列的算法).本人逻辑有点差啊,废了老大功夫才实现,也没啥就牛逼的,就是拿出来分享一下,给需要的同学节省点时间,如果有用的话别忘赞一 ...
- mdf与ldf文件如何还原到SQLserver数据库
现在又如下两个文件 需要用这两个文件还原数据库 那么该怎么去还原呢? 首先在D盘目录下建立一个文件夹test,然后将上图中的文件粘贴到该文件夹中. 接着在数据库中执行如下代码: EXEC sp_att ...
- virtualbox centos安装增强工具
系统的,VBoxLinuxAdditions-amd64.run 是用于64位系统的.执行以下命令来安装sh ./VBoxLinuxAdditions-x86.run 5.安装成功后重启系统.
- awk简明教程
我在这里的教程并不想面面俱到,全是示例,基本无废话. 我只想达到两个目的: 1)你可以在乘坐公交地铁上下班,或是在坐马桶拉大便时读完(保证是一泡大便的工夫). 2)我只想让这篇博文像一个火辣的脱衣舞女 ...
- Async详解之一:流程控制
为了适应异步编程,减少回调的嵌套,我尝试了很多库.最终觉得还是async最靠谱. 地址:https://github.com/caolan/async Async的内容分为三部分: 流程控制:简化十种 ...