MS-DOS Batch Script Template
@echo off
@setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION @rem Name:
@rem Purpose:
@rem
@rem Author:
@rem Revision:
@rem @rem @echo off
@rem @set method=goto:eof
@rem @set mbegin=setlocal
@rem @set mend=endlocal^&goto:eof @rem ^& call :quit ^%errorlevel^%
@set method=@goto:eof
@set mbegin=@set a1xyzefwew=""
@set mend=@goto:eof
@set mreturn=@exit /b !errorlevel!
@set return=@goto :on_exit @set errorlevel=0 @rem go to rum main()
@goto :main %method%
: usage ()
%mbegin% echo %~1% %mend% %method%
: config ()
%mbegin% set me=%~n0
set mex=%~nx0 @rem
@rem initialize configuration items here
@rem
set HEAD_LINE=***************** call :parse_commind_line %* %mend% %method%
: main ()
%mbegin% @rem Check if need to show help informaiton
if "%~1" neq "" (
set param1=%~1
if "!param1:/?=!" neq "!param1!" (
call :usage %~nx0
exit /b 1
)
) @rem load configuration
call :config %* @rem initilize log environment
call :init_log @rem log example
@rem set log=C:\windows\system32\inetsrv\appcmd.exe set config "UimDirectAuxTestWebSite" /section:UimDirectAuxModule/"+references.[name='JOSE-JWWD_Server\AuthenFilter\uim-direct-aux\UimDirectAuxWebTest\uim_direct_aux\bin\jose-jwt.dll']"
@rem call :tee "%log%" @rem
@rem add business logical here
@rem @rem for example, call a method
@rem call :method1 || ( set errorlevel=1 & %return%) %return% %mend% %method%
: method1 ()
%mbegin% @rem mkdir foldername >nul || (set errorlevel=1 & %mreturn%) @rem set errorlevel=0 & %mreturn% %mend% %method%
: parse_commind_line ()
%mbegin%
:lbl_param_list
shift /1
if "%1" equ "" (
goto:eof
) @rem read optional args
@REM set p=%~1
@REM set p2=%p:/old_filter=%
@REM if /i "%p%" neq "%p2%" (
@REM if /i "%~2" neq "" (
@REM set g_optional_param_name=%~2
@REM )
@REM )
goto :lbl_param_list %mend% %method%
: print_head ()
%mbegin%
@call :log_prefix
@echo %LOG_PREFIX% %HEAD_LINE% %mex% log %HEAD_LINE% > %log_file%
%end% %method%
: print_foot ()
%mbegin%
@call :log_prefix
@echo %LOG_PREFIX% %HEAD_LINE% %mex% log %HEAD_LINE% >> %log_file%
%end% %method%
: init_log ()
%mbegin%
@rem get log file name
set log_file=%LOCALAPPDATA%\%me%\log
if not exist %log_file% (
mkdir %log_file% || echo "failed to create %log_file% with error %errorlevel%" & got :eof
)
set log_file="%log_file%\%mex%.log" @rem initialize the log file
call :print_head
%mend% %method%
@rem
@rem output message to both stdout and %log_file%
@rem
: tee ()
@rem
@rem %* -- message
@rem
%mbegin%
@call :log_prefix
@set tee_log=%* @rem remove left "
set left_char=%tee_log:~0,1%
set left_char=%left_char:"=%
if "%left_char%" equ "" (
set tee_log=%tee_log:~1%
)
@rem remove right "
set right_char=%tee_log:~-1,1%
set right_char=%right_char:"=%
if "%right_char%" equ "" (
set tee_log=%tee_log:~0,-1%
) @set tee_log=%LOG_PREFIX% %tee_log%
echo %tee_log%
@echo %tee_log% >> %log_file%
%mend% %method%
: log_prefix
%mbegin%
@set LOG_PREFIX=[%date:~0,-4% %time%]
%mend% %method%
@rem
@rem exit the batch with checking the error code
@rem please use this method by "goto :on_exit" rather than "call :on_exit"
@rem
: on_exit ()
%mbegin%
if %errorlevel% neq 0 (
echo %LOG_PREFIX% Failed to execute %mex%. For more information, please %log_file%
) else (
echo %LOG_PREFIX% Succeeded in executing %mex%. For details, please %log_file%
)
call :print_foot
@rem type %log_file%
endlocal
exit /b %errorlevel%
%mend%
MS-DOS Batch Script Template的更多相关文章
- Use windows batch script to create menu
Background Recently, I find that we need to type some very long gradle commands to run build, chec ...
- 今天再给大家带点html5前端开发的干货模板“text/tpl”怎么用 script template怎么用
text/tpl 顾名思义就是模板,其实和C++模板函数类似的作用,就是利用他生成一个HMTL内容,然后append或者替换html里面 有什么好处,假如后端返回来的数据都是一样的,但是需要生成不同的 ...
- 小白学习vue第五天-第二弹(全局局部、父子、注册语法糖,script/template抽离模板)
全局组件: 就是注册的位置在实例对象的外面 并且可以多个实例对象使用 而局部: 就是在实例对象的内部注册 父组件和子组件的关系 子组件就是在另一个组件里面注册的组件 组件注册语法糖: 就不用Vue.e ...
- MS DOS 命令大全
刚好看到留下来以备用: 一)MD——建立子目录命令 1.功能:创建新的子目录 2.类型:内部命令 3.格式:MD[盘符:][路径名]〈子目录名〉 4.使用说明: (1)“盘符”:指定要建立子目录的磁盘 ...
- 在Virtual Box虚拟机中安装MS DOS!
原文地址:https://mylinuxramblings.wordpress.com/2010/12/05/linux-mint-debian-edition-lmde-first-impressi ...
- MS dos版本
1981年,MS-DOS 1.0发行,作为IBM PC的操作系统进行捆绑发售,支持16k内存及160k的5寸软盘.在硬件昂贵,操作系统基本属于送硬件奉送的年代,谁也没能想到,微软公司竟会从这个不起眼的 ...
- MS DOS 常用命令整理
最近在开发用到一些dos下的一些指令,还有bat文件,特别是bat的便捷性让我在生活和开发过程中好好使用. dos指令: java com.pdcss.util.JacobService > D ...
- Create Script Template In Edit Mode
很多时候 许多类 的 格式 都是重复的,比如 从配置文件中映射出来的类. 这个时候写一个 类模板 就很节省时间了. Code public static string TestPath = " ...
- bat脚本-set(setlocal enabledelayedexpansion) 学习
设置本地为延迟扩展.其实也就是:延迟变量,全称延迟环境变量扩展. 事件一: @echo off set a=4 set a=5&echo %a% pause 解说:为什么是4而不是5呢?在ec ...
随机推荐
- HDMI接口基础知识及硬件设计
参考资料:http://blog.csdn.net/u013625961/article/details/53434189: http://blog.csdn.net/u014276460/artic ...
- ios28--UIScrollView
// // ViewController.m // UIScrollVIew #import "ViewController.h" @interface ViewControlle ...
- confusion_matrix函数的使用
from:http://blog.csdn.net/m0_38061927/article/details/77198990 官方文档中给出的用法是 sklearn.metrics.confusion ...
- go语言---for
go语言---for https://blog.csdn.net/cyk2396/article/details/78873930 执行以下代码,发现无法跳出for循环: func SelectTes ...
- 10.04 FZSZ模拟Day1 总结
今天轮到FZSZ出题了,这可是连续两年捧杯NOI的学校了…… 可想而知今天题难度有多大……不过似乎还要庆幸出题的是一位叫Anzhe Wang 的大神而不是fjzzq? T1.permutation 期 ...
- EasyUI Calendar 日历
转自:http://www.jeasyui.net/plugins/175.html 通过 $.fn.calendar.defaults 重写默认的 defaults. 日历(calendar)显示允 ...
- EasyUI Datagrid 分页显示(客户端)
转自:https://blog.csdn.net/metal1/article/details/17536185 EasyUI Datagrid 分页显示(客户端) By ZYZ 在使用JQuery ...
- 全分布式的Hadoop虚拟机安装
在集群环境下装机.配置.运行的全过程,梳理总结到本文中. 第一部分:环境规划 •用户 hadoop 密码 hadoop •机器 机器名称 IP地址 Master.Hadoop 192.168.1.10 ...
- 基于PHP自带的mail函数实现发送邮件以及带有附件的邮件功能
PHPmail函数简介 bool mail ( string $to , string $subject , string $message [, string $additional_headers ...
- 通过usb访问mtp设备(ubuntu12.04) (转载)
转自:http://robert.penz.name/658/howto-access-mtp-devices-via-usb-on-ubuntu-12-04/ A friend asked me h ...