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 ...
随机推荐
- c#多层嵌套Json
Newtonsoft.Json.Net20.dll 下载请访问http://files.cnblogs.com/hualei/Newtonsoft.Json.Net20.rar 在.net 2.0中提 ...
- C#主要支持 5 种动态创建对象的方式
C#主要支持 5 种动态创建对象的方式: 1. Type.InvokeMember 2. ContructorInfo.Invoke 3. Activator.CreateInstance(Type) ...
- V2EX社区
无论你是在大学进行人生最重要阶段的学习,或者是在中国的某座城市工作,或者是在外太空的某个天体如 Sputnik 1 上享受人生,在注册进入 V2EX 之后,你都可以为自己设置一个所在地,从而找到更多和 ...
- [转]浅析AD Exchange——RTB模式
在上一篇文章中,我们了解了程序化购买,并且知道程序化购买的最基本的一种RTB的竞价模式,了解了DSP.SSP.Ad Exchange等概念,不清楚的同学可以看看上一篇文章<程序化购买>. ...
- Cassandra1.2文档学习解读计划——为自己鼓劲
最近想深入研究一下Cassandra,而Cassandra没有中文文档,仅有的一些参考书都是0.7/0.6版本的.因此有个计划,一边学习文档(地址:http://www.datastax.com/do ...
- WINDOWS下PHP 的pear DB的安装(本地环境:PHP5.4.15+Apache+mysql)
因为需要安装phpunit,要先装pear,网上的教程大多数是以双击go-pear.bat开始,但是我安装的php文件夹里压根没有这个文件. 经过几次搜索之后终于找到了办法. 解决步骤如下: 1.下载 ...
- 为checkboxSelectionModel赋值
store.on('load', function(store, records, options) { sm.clearSelections(); //清空数据 Ext.each(records ...
- WebApp
目前的手机APP有三类:原生APP,WebAPP,HybridApp:HybridApp结合了前两类APP各自的优点,越来越流行. Hybrid App的兴起是现阶段移动互联网产业的一种偶然.移动互联 ...
- 如何访问Microsoft Azure Storage
首先先要创建存储账户 http://www.cnblogs.com/SignalTips/p/4119128.html 可以通过以下的几个方式访问 通过Visual Studio 2013 Commu ...
- ASP.NET从数据库中取出数据,有数据的复选框为选中
在KS系统中在更新菜单的时候,当查出菜单的时候要查出菜单下面已经有了哪些界面了我用了一下的方法弄的.代码如下: 界面代码: <%@ Page Language="C#" Au ...