59 lines
1021 B
Batchfile
59 lines
1021 B
Batchfile
@echo off
|
|
setlocal EnableDelayedExpansion
|
|
cd /d %~dp0
|
|
|
|
net.exe session 1>NUL 2>NUL && (
|
|
goto as_admin
|
|
) || (
|
|
goto not_admin
|
|
)
|
|
|
|
:as_admin
|
|
::读取版本配置文件
|
|
set configVersion=version.txt
|
|
for /f "tokens=1,2,3 delims=." %%a IN (%configVersion%) Do (
|
|
set tag1=%%a
|
|
set tag2=%%b
|
|
set tag3=%%c
|
|
)
|
|
set /a tag3=1+%tag3%
|
|
set oldVersion=%tag1%.%tag2%.%tag3%
|
|
|
|
::替换
|
|
set d=%date: =0%
|
|
set t=%time: =0%
|
|
|
|
set productname=%oldVersion%.%d:~2,2%%d:~5,2%%d:~8,2%%t:~0,2%%t:~3,2%%t:~6,2%
|
|
echo %productname%
|
|
echo %productname%> version.txt
|
|
del /q *.panda
|
|
echo .>%oldVersion%.panda
|
|
|
|
cd ..
|
|
del /q *.panda
|
|
echo .>%oldVersion%.panda
|
|
|
|
cd 2.database
|
|
del /q *.panda
|
|
echo >v%oldVersion%.panda
|
|
|
|
if not exist v%oldVersion% md v%oldVersion%
|
|
cd v%oldVersion%
|
|
if not exist 脚本文件.txt echo -- 数据库脚本(%productname%)>脚本文件.txt
|
|
set jb=%cd%\脚本文件.txt
|
|
|
|
cd ..
|
|
echo pp=%jb%
|
|
del /q 脚本文件.txt
|
|
mklink 更新脚本.txt %jb%
|
|
echo 执行成功,生成 v%oldVersion%
|
|
goto end
|
|
|
|
:not_admin
|
|
echo not as admin
|
|
|
|
:end
|
|
ping 127.0.0.1 -n 3 >nul
|
|
exit
|
|
|