请教版主,我按照你的方法做了如下脚本,但是向网络上拷贝的时候,拷贝不成功啊
脚本如下:- ECHO **** READ IP
- for /f "tokens=15" %%i in ('ipconfig ^| find /i "ip address"') do set ip=%%i
-
- @ECHO OFF&setlocal enableDelayedExpansion
- set file=%date:~0,4%%date:~5,2%%date:~8,2%
- set name=%date:~0,4%%date:~5,2%
- set d=%date%
- set t=%time:~0,-3%
-
- echo ***** network
- if exist S: net use S: /d /y > NUL:
- if exist T: net use T: /d /y > NUL:
-
- net use S: \\192.168.113.240\transfer_record "manta" /user:"mantauser"
- IF ERRORLEVEL 1 goto errormsg
- net use T: \\192.168.113.240\epat_data "manta" /user:"mantauser"
- IF ERRORLEVEL 1 goto errormsg
-
- if exist C:\ETT\ecelltest08 set equip=ecelltest08&goto Ecell08
- goto end
-
- :ecell08
- 2>nul (for %%a in (d:\正常代码\*.*) do if "%%~xa"=="" set a=%%a&md T:\testcell\ecelltest08\正常代码\!a:~0,5!© "%%a" T:\testcell\ecelltest08\正常代码\!a:~0,5!)
- xcopy D:\正常代码\*.* d:\backup\%name%\正常代码\ /s /y
- rem xcopy D:\故障码\*.* T:\testcell\ecelltest08\%name%\ /s /y
- IF ERRORLEVEL 1 goto end
- rem erase D:\正常代码\ /s /f /q
-
- xcopy D:\异常代码\*.* d:\backup\%name%\异常代码\ /s /y
- 2>nul (for %%a in (d:\异常代码\*.*) do if "%%~xa"=="" set a=%%a&md T:\testcell\ecelltest08\异常代码\!a:~0,5!&move "%%a" T:\testcell\ecelltest08\异常代码\!a:~0,5!)
-
- rem xcopy D:\故障码\*.* T:\testcell\ecelltest08\%name%\ /s /y
- IF ERRORLEVEL 1 goto end
- rem erase D:\正常代码\ /s /f /q
-
- echo %d% %t% ***%equip% IP:%IP%*** ecelltest08_dataupdate is finish! >>S:\ecelltest08.log
- goto end
复制代码 运行结果是:文件拷贝到T:\testcell\ecelltest08 不成功,但是拷贝到d盘的backup没问题;
为什么啊? |