写自动作版本的bat

需求如下

 

1,在08.単体試験/単体テストバージョン/ 上,以YYYYMMDDHHMM的格式建目录,并将变编译好的Assembly放入

2,用准备好的配置文件覆盖SRAB.exe.config

3,把服务器端的RemoteService删掉,并将编译好的RemoteService放入

 

source如下

 

@set configdir=C:/環境
@set fromdir=F:/sra3/source
@set tsp="%time:~0,1%"
if %tsp%==" " (@set dir=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%) else (@set dir=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%)
@set toclientdir=Y:/08.単体試験/単体テストバージョン/%dir%/Assembly
@set toserverdir=Z:/RemoteService
md %toclientdir%
rd /s /q z:/RemoteService
md z:/RemoteService
xcopy /Y /E %fromdir%/RemoteService %toserverdir%/
xcopy /Y %configdir%/web.config %toserverdir%/web.config
xcopy /E %fromdir%/Assembly %toclientdir%/
xcopy /Y %configdir%/SRAB.exe.config %toclientdir%/SRAB.exe.config
@pause

 

解释如下

//设置准备好的配置文件路径

@set configdir=C:/環境

//编译好的source源路径
@set fromdir=F:/sra3/source

//取时间的第一位,如果<10点的话,取到的是空
@set tsp="%time:~0,1%"

//时间<10点的话,第一位补零

//%time:~1,1% 表示从当前时间字符串的第二位开始取一个字符

//%date:~0,4%表示从当前日期字符串的第一位开始取四个字符
if %tsp%==" " (@set dir=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%) else (@set dir=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%)

@set toclientdir=Y:/08.単体試験/単体テストバージョン/%dir%/Assembly
@set toserverdir=Z:/RemoteService


//在08.単体試験/単体テストバージョン/ 上,以YYYYMMDDHHMM的格式建目录

md %toclientdir%

 

//删除目录(目录里的文件也一并删除)
rd /s /q z:/RemoteService

 

//建目录
md z:/RemoteService

 

//xcopy /Y 禁止提示您确认要覆盖现存的目标文件Z

//隐藏文件是不复制的。
xcopy /Y /E %fromdir%/RemoteService %toserverdir%/
xcopy /Y %configdir%/web.config %toserverdir%/web.config

//xcopy /E 复制目录和子目录,包括空的。
xcopy /E %fromdir%/Assembly %toclientdir%/
xcopy /Y %configdir%/SRAB.exe.config %toclientdir%/SRAB.exe.config

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值