下面是我进行打包的代码,有时候打包成功,有时候打包失败,这是什么原因- @echo off
- Setlocal Enabledelayedexpansion
- echo.
- echo.=====================================================================
- set FolderName=D:\WwwRoot\bss.abc.com\WebRoot
- for /f "delims=" %%a in ('dir /b /a-d /oN "%FolderName%\*.txt"') do (
- set d=%%a
- set c=!d:~0,-4!
- echo !c!
- )
- echo.
- set PathName=D:\WwwRoot
- set bss=bss.abc.com
- ping 127.0.0.1 -n 5 >nul
- Setlocal Enabledelayedexpansion
- echo.
- cls
- echo.---------正在备份网站到BackUp-----------------------
- 7z.exe a %PathName%\%bss%\BackUp\"%bss%%c%".7z %PathName%\%bss%\WebRoot\* 1>nul 2>nul&&echo 打包完成 ||echo 打包失败
- echo.
- ping 127.0.0.1 -n 10 >nul
- if ERRORLEVEL 1 (
- echo 打包失败
- goto end
- ) else (
- echo 打包完成
- goto judge
- )
- :judge
- tasklist /nh|find /i "7zFM.exe"
- if ERRORLEVEL 1 (
- echo 7zFM.exe不存在
- goto back1
- ) else (
- echo 7zFM.exe存在
- )
- :back1
- pause
复制代码
|