Batch file 如何使用批处理将文件复制并粘贴到文件夹中
我想创建一个批处理文件,将文件夹的内容复制并粘贴到另一个文件夹中。说Batch file 如何使用批处理将文件复制并粘贴到文件夹中,batch-file,xcopy,Batch File,Xcopy,我想创建一个批处理文件,将文件夹的内容复制并粘贴到另一个文件夹中。说 source: D:\backup\test destination: D:\backup1 但在这里,我想在目标中创建一个子文件夹,我可以将文件粘贴到其中 @echo off :: variables echo Backing up file set /P source=Enter source folder: set /P destination=Enter Destination
source: D:\backup\test
destination: D:\backup1
但在这里,我想在目标中创建一个子文件夹,我可以将文件粘贴到其中
@echo off
:: variables
echo Backing up file
set /P source=Enter source folder:
set /P destination=Enter Destination folder:
set listfile=xcopy /L
set xcopy=xcopy /S/E/V/Q/F/H
%listfile% %source% %destination%
echo files will be copy press enter to proceed
pause
%xcopy% %source% %destination%
pause
那可能会帮助你
set FOLDER_CURRENT=%cd%
set VERSION= what u want
set FOLDER_SRC= what u want
set FOLDER_OUT= what u want
mkdir %FOLDER_OUT%
echo * Create the file xcopy_EXCLUDE.txt in order to ignore some file and directory.
echo * - ignore all .au3 files
echo * - ignore all .pspimage files
echo * - ignore the \psp\ directory
echo .au3 > xcopy_Exclude.txt
echo .pspimage >> xcopy_Exclude.txt
echo \psp\ >> xcopy_Exclude.txt
echo * The file xcopy_EXCLUDE.txt is created.
echo.
echo * Copy files with xcopy.
xcopy "%FOLDER_SRC%" "%FOLDER_OUT%" /E /H /Y /EXCLUDE:xcopy_Exclude.txt
echo * Files and directory are copied.
echo.
echo * Delete xcopy_Exclude.txt.
del xcopy_Exclude.txt
if not exist
检查目录是否存在。如果没有,则由mkdir
创建
@echo off
echo Backing up the file
set /p source=Enter source folder:
set /p destination=Enter destination folder:
if not exist %destination% mkdir %destination%
set listfile=xcopy /L
set xcopy=xcopy /S/E/V/Q/F/H
%listfile% %source% %target%
echo Files listed will be copied.
pause
%xcopy% %source% %destination%
使用xcopy标记表明您已经知道
xcopy
命令。对于这样的事情,这绝对是一个很好的命令。到目前为止,您尝试了什么?我创建了一个批处理文件,可以将数据从一个文件夹复制到另一个文件夹。但我想将该数据复制到我必须在目标位置使用命令创建的子文件夹中。很抱歉,我粘贴了错误的文件。。。。这是我的批处理文件:-@echo off::variables echo backup file set/P source=Enter source folder:set/P destination=Enter destination folder:set listfile=xcopy/L set xcopy=xcopy/S/E/V/Q/F/H%listfile%%source%%destination%echo文件将被复制按Enter继续暂停%xcopy%%source%%destination%pause请将代码添加到你的原始问题,以便其他人更容易阅读。现在我被你想要的东西弄糊涂了。如果目标目录不存在,xcopy将创建它。
this is my script which i got success..
@echo off
:: variables
echo Backing up file
set /P source=Enter source folder:
set /P destination=Enter Destination folder:
set /P Folder=Enter Folder name:
@echo folder=%folder%
mkdir %destination%\%folder%
set xcopy=xcopy /S/E/V/Q/F/H/I
%xcopy% %source% %destination%\%folder%
echo files will be copy press enter to proceed
pause