Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 批处理文件不会复制文件_Windows_Batch File_Batch Processing - Fatal编程技术网

Windows 批处理文件不会复制文件

Windows 批处理文件不会复制文件,windows,batch-file,batch-processing,Windows,Batch File,Batch Processing,我创建了一个批处理文件,用于将文件从ftp服务器复制到共享驱动器。我不太会写剧本。当我运行.bat文件时,我得到一个错误“找不到源文件夹”。如果我使用WINSCP,我可以进入目录并查看没有问题的文件 @Echo Off ftp xxxxxx.org xxx Set _UserName=xxxxxxxx Set _Password=xxxxxxxx set Source=ftp://ftp.xxxxxx.org/LOPE/mobiledoc set Target=Z:\Sca

我创建了一个批处理文件,用于将文件从ftp服务器复制到共享驱动器。我不太会写剧本。当我运行.bat文件时,我得到一个错误“找不到源文件夹”。如果我使用WINSCP,我可以进入目录并查看没有问题的文件

@Echo Off
ftp xxxxxx.org xxx
Set _UserName=xxxxxxxx
Set _Password=xxxxxxxx 
set Source=ftp://ftp.xxxxxx.org/LOPE/mobiledoc          
set Target=Z:\Scanned_Documents\LOPE
set FileList=Z:\Scanned_Documents\LOPE\FileList_LOPE.idx

if exist Z:\Scanned_Documents\LOPE\NUL echo "Folder already exists"
if not exist Z:\Scanned_Documents\LOPE\NUL echo "Folder does not exist"
if not exist "%Source%" echo Source folder "%Source%" not found & goto Exit
if not exist "%FileList%" echo File list "%FileList%" not found & goto Exit
if not exist "%Target%" md "%Target%"


for /F "delims=" %%a in ('type "%FileList%"') do copy "%Source%\%%a" "%Target%"

:Exit
echo.
echo press the Space Bar to close this window.
pause > nul

您的脚本存在一些问题。当您调试它时,我建议您暂时注释掉第一行
@Echo off
,这样您就可以看到发生了什么


关于您的具体问题:
如果不存在
将不会检查FTP位置上是否存在文件对象。它只适用于文件系统。

您的脚本存在一些问题。当您调试它时,我建议您暂时注释掉第一行
@Echo off
,这样您就可以看到发生了什么


关于您的具体问题:
如果不存在
将不会检查FTP位置上是否存在文件对象。它只适用于文件系统。

我更改了两件事:删除了回音。我在Target和Filelist语句周围加了引号。我还进入了文件列表文件,并将目录添加到文件列表文件的文件名中。我收到的错误表明文件名、目录名或卷标签语法不正确。我更改了两件事:删除了echo。我在Target和Filelist语句周围加了引号。我还进入了文件列表文件,并将目录添加到文件列表文件的文件名中。收到的错误表明文件名、目录名或卷标签语法不正确。