批处理:从计算机复制到网络驱动器

时间:2014-03-21 08:48:12

标签: windows batch-file command-line xcopy

我写了一个批处理文件,它会做一些测试然后将结果复制到网络驱动器。这种用法对我来说很好,但在过去几天我注意到它对我不起作用,其他人说它从来没有为他们工作过。

这是我打算复制到M的部分:我们网络上的所有计算机都可以看到。正在调用该部分,并且正在创建存档结果文件夹,但没有任何内容被发送到目标驱动器。

有人能看出我做错了吗?

:CopyResults
SET CLASSPATH=%CLASSPATH_ORIGINAL%
For /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set mydate=%%a-%%b-%%c)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)

set source="target"
set Archive= "Archived Results\Test Results - %CLIENTCHOICE% %mydate% At %mytime% Using %BROWSEROPTION%"
set ScreenshotDestination= "Archived Results\Test Results - %CLIENTCHOICE% %mydate% At %mytime% Using %BROWSEROPTION%\Screenshots"
mkdir %Archive%
echo %Archive%
echo d | xcopy %source% %Archive% /k /e /d /y /h /i

rem copy screenshots
set screenshots="Screenshots"
echo d | xcopy %screenshots% %ScreenshotDestination% /k /e /d /y /h /i

%Archive%\site\index.html

rem copy accross to M:
set Destination= "M:\ProductTesting\AutomationResults\%CLIENTCHOICE%\%mydate% At %mytime% Using %BROWSEROPTION% Ran By %username%"
set ScreenshotDestination= "M:\ProductTesting\AutomationResults\%CLIENTCHOICE%\%mydate% At %mytime% Using %BROWSEROPTION%\Screenshots"
set source="target"
mkdir %Destination%
echo %Destination%
echo d | xcopy %source% %Destination% /k /e /d /y /h /i

rem copy screenshots
set screenshots="Screenshots"
echo d | xcopy %screenshots% %ScreenshotDestination% /k /e /d /y /h /i
GOTO Del

0 个答案:

没有答案