我编写了以下同步代码批处理,将主硬盘驱动器中的所有数据刷新到备份驱动器中。由于驱动器名称可以更改,我使用了一个技巧,将master.txt放入源驱动器,将backup.txt放入备份驱动器。通过这种方式,我可以轻松找到源和备份。 Omn windows 7它运行得很好但是一旦进入WinCE内部就会死。
cls
::@echo off
PATH=\hard disk;\hard disk2;\hard disk3;\hard disk4;e:;f:;g:
for %%A in ("%path:;=";"%") do (
if exist %%~A\master.txt (
echo found %%~A\master.txt
SET data=%%~A\Rilevamenti
)
if exist %%~A\backup.txt (
echo found %%~A\backup.txt
SET backup=%%~A
)
)
echo source path is: %data%
:logfile
Time /T > Time.dat
SET /P ftime= < Time.dat
SET DirName=BackupFiles%date:~6%%date:~3,2%%date:~0,2%%ftime:~0,2%%ftime:~3,2%
SET backup=%backup%\%DirName%
echo backup dir is: %backup%
pause
mkdir "%backup%"
echo 1 > LogSyncFile_src
echo 1 > LogSyncFile_dst
SET COPYCMD=/Y
for /R "%data%" %%F in (*.CSV) do (
move %%F %backup%\%%~nxF
echo %%~nxF >> LogSyncFile_src
)
for /R "%backup%" %%F in (*.CSV) do (
echo %%~nxF >> LogSyncFile_dst
)
SET /P Build=<LogSyncFile_src
SET /P Synch=<LogSyncFile_dst
if %Build%==%Synch% (
goto :delete
) else (
goto :fail
)
:fail
echo synchronization failed!
goto :exit
:lowmemory
echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto :exit
:abort
echo You pressed CTRL+C to end the copy operation.
goto :exit
:delete
echo synchronization completed!
goto :exit
:exit
pause
在第一个循环的WinCE上我得到:
for %% A in(&#34;%path:; =&#34 ;;&#34;%&#34;)do(无法执行for.exe
有关进展情况的任何帮助?这是我第二次以不同的方式编写相同的批处理以获得WinCE的工作,但似乎我错过了一些东西......