本帖最后由 229989799 于 2017-9-8 09:40 编辑
批量转换的,没测试过,很多空行也没删除,自己处理一下吧。。
RunWait(@ComSpec & ' /c ' & 'echo off', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo 正在备份服务,如果优化出了问题您可以及时', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo 恢复.备份会生成一个以当前时间命名的批处', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo 理文件,恢复时只要双击即可.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'rem get current date and time', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'for /f "tokens=1, 2, 3, 4 delims=-/. " %j in (' & "'" & _
'Date /T' & "'" & _
') do set FILENAME=srv_%j_%k_%l_%m', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'for /f "tokens=1, 2 delims=: " %j in (' & "'" & _
'TIME /T' & "'" & _
') do set FILENAME=xinfuwu.txt', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'rem get all service name', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'sc query type= service state= all| findstr /r /C:"SERVICE_NAME:" >tmpsrv.txt', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo 正在备份,请稍等...', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'rem save service start state into batch file ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'for /f "tokens=2 delims=:" %j in (tmpsrv.txt) do @( sc qc %j |findstr START_TYPE >tmpstype.txt && for /f "tokens=4 delims=:_ " %s in ( tmpstype.txt) do @echo%j>>"%FILENAME%")', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'del tmpsrv.txt', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'del tmpstype.txt', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo 服务已备份到:', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo %FILENAME%', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & 'echo.', '', @SW_HIDE)
RunWait(@ComSpec & ' /c ' & ' ', '', @SW_HIDE)
|