dos bat windows脚本

update & build

@echo off
rem for /f "tokens=2 delims==" %I in ('wmic os get localdatetime /value') do set datetime=%I
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set datetime=%%I
set datetime=%datetime:~0,14%
echo %datetime%

d:
cd D:\SVN\y2Ljy\dist
del *.zip
svn update >D:\logs\y2Ljy_build_%datetime%.log

cd D:\scripts\ERP-WEB
echo %datetime% svn update time >version.txt
rem findstr revision D:\logs\y2Ljy_build_%datetime%.log >>version.txt
findstr revision D:\logs\y2Ljy_build_%datetime%.log|awk -F "[ .]+" "{print $3,$2}" >>version.txt

cd d:\SVN\y2Ljy\
npm run build >>D:\logs\y2Ljy_build_%datetime%.log && D:\scripts\ERP-WEB-build_to_zip.bat

 

build to zip

@echo off
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /value') do set datetime=%%I
set datetime=%datetime:~0,14%
echo %datetime%

d:
cd D:\scripts\ERP-WEB

for /f %%i in ('FINDSTR  "revision"  version.txt') do set version=%%i
set version=%version%
echo %version%

cd D:\SVN\y2Ljy\dist
WinRAR a ERP-WEB-%version%-%datetime%.zip static\css
WinRAR a ERP-WEB-%version%-%datetime%.zip static\fonts
WinRAR a ERP-WEB-%version%-%datetime%.zip static\img
WinRAR a ERP-WEB-%version%-%datetime%.zip static\js
WinRAR a ERP-WEB-%version%-%datetime%.zip static\music
WinRAR a ERP-WEB-%version%-%datetime%.zip index.html
copy ERP-WEB-%version%-%datetime%.zip D:\scripts\ERP-WEB
cd D:\scripts\ERP-WEB\
scp ERP-WEB-%version%-%datetime%.zip root@192.168.10.165:backup/
scp ERP-WEB-%version%-%datetime%.zip root@192.168.10.165:backup/ERP-WEB.zip

 

posted @ 2024-03-18 16:30  zhaoguanhao  阅读(3)  评论(0编辑  收藏  举报