- @echo off
- setlocal enabledelayedexpansion
- set timeDIR=%date:~0,4%%date:~5,2%%date:~8,2%
- if exist d:\MobileServer (
- set appPath=d:\MobileServer\
- set backUp=d:\backUp\
- set serviceList=d:\test\
- set errorLog=d:\
- ) else (
- set appPath=e:\MobileServer\
- set backUp=e:\backUp\
- set serviceList=e:\test\
- set errorLog=e:\
- )
- md %backUp%%timeDIR%
- FOR /F %%i in (%serviceList%autoUpdate.txt) do (
- for /f "delims=" %%m in ('dir /ad/b "%~dp0"') do (
- for /f "tokens=1,2,3 delims=," %%a in ("%%i") do (
- set str1=%%a
- set str2=%%b
- set str3=%%c
- if %%m==%%a (
- rar a %backUp%%timeDIR%\%%a.rar %appPath%%%m
- taskkill /f /t /im %%b
- xcopy /y %~dp0%%a %appPath%%%a
- sc start %%c
- echo %errorlevel%
- if errorlevel 1 (
- goto loop
- )
- :loop
- sc start %%c
- if errorlevel 1 (
- echo %%a此文件夹对应的服务启动失败 >>%errorLog%%timeDIR%.txt
- )
- )
- )
- )
- )
- pause
复制代码 在启动服务的时候就会卡住弹出如图 我确定我什么都没按
windows server 2008 r2 的系统 谁知道是为什么啊 |