@echo off
Setlocal Enabledelayedexpansion
echo.
set FolderName=D:\WwwRoot\a.test.com\WebRoot
for /f "delims=" %%a in ('dir /b /a-d /oN "%FolderName%\*.txt"') do if not defined d set d=%%~na
set c=%d%
echo %c%
echo.
set test=a.test.com
7z.exe a %PathName%\%test%\BackUp\"%test%%c%".7z %PathName%\%test%\WebRoot\*
测试发现,按照这样写的话,我下面的代码不能执行了,比如这个打包的
echo.---------正在备份网站到-----------------------
set test=a.test.com
7z.exe a %PathName%\%test%\BackUp\"%report%%d%".7z %PathName%\%test%\WebRoot\*