求教,如何使用bat复制指定文件夹(或文件)到指定目录下,并且压缩整个文件夹(或文件)

用xcopy的命令的,比如复制D:/A下所有文件复制到F:/B这个目录里,并且只留下一个B文件夹的压缩包AAA.zip(压缩完后删除B文件夹)

不清楚你的实际文件/情况,仅以问题中的样例/说明为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI
@echo off
rem 将一个指定文件夹里的所有文件拷贝/复制到另一个文件夹里并进行压缩打包
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
set "oldfolder=D:\A"
set "newfolder=F:\B"
set "exefile=C:\Program Files\WinRAR\WinRAR.exe"
if not exist "%oldfolder%" (echo;"%oldfolder%" not found&goto end)
if not exist "%newfolder%" md "%newfolder%"
if not exist "%exefile%" (echo;"%exefile%" not found&goto end)
xcopy "%oldfolder%" "%newfolder%\" /y /e /q /r /h
"%exefile%" a -y -r -ep1 ".\xxx.zip" "%newfolder%\*"
:end
echo;%#% +%$%%$%/%@% %z%
pause
exit追问

提示了 "C:\Program Files\WinRAR\WinRAR.exe" not found

追答

按运行后窗口标题栏中的提示联系我

温馨提示:答案为网友推荐,仅供参考
相似回答