1.

Solve : "Find" does not work?

Answer»

Hello I am programming a batch file for windows XP. The programma has to copy and UNZIP a file if the zip file on the netwerk (F:) is newer then the file on the computer (C:). This is what I have untill now, the function FC RETURNS if the files are the same "FC: geen verschillen gevonden". And with the Find function i try to find that. But i think the find function doesn't work. What is needed to get it working? Or is there a other way, to do this?

Greetz Champy

---

@ECHO OFF
IF NOT EXIST f: goto stop

FC "F:\data\Besturing\Standaard\Capway S7 libary\capway.zip" "C:\Program Files\Siemens\Step7\S7LIBS\capway.zip"

find "FC: geen verschillen gevonden"

if errorlevel 0 goto stop

xcopy /d "F:\data\Besturing\Standaard\Capway S7 libary\capway.zip" "C:\Program Files\Siemens\Step7\S7LIBS"

unzip -o "C:\Program Files\Siemens\Step7\S7LIBS\capway.zip" -d "C:\Program Files\Siemens\Step7\S7LIBS"

regedit /s "C:\Program Files\Siemens\Step7\S7LIBS\capway\s7comm.reg"

:stop

exit

----You don't need a Find command. The errorlevel will indicate whether the files are equal or not.

Code: [Select]@ECHO OFF
IF NOT EXIST f: goto stop

FC "F:\data\Besturing\Standaard\Capway S7 libary\capway.zip" "C:\Program Files\Siemens\Step7\S7LIBS\capway.zip"
if errorlevel 1 goto next
goto stop

:next
xcopy /d "F:\data\Besturing\Standaard\Capway S7 libary\capway.zip" "C:\Program Files\Siemens\Step7\S7LIBS"
unzip -o "C:\Program Files\Siemens\Step7\S7LIBS\capway.zip" -d "C:\Program Files\Siemens\Step7\S7LIBS"
regedit /s "C:\Program Files\Siemens\Step7\S7LIBS\capway\s7comm.reg"

:stop

exit

Not sure what your logic is, but as WRITTEN, if and only if the files from the compare are unequal are the xcopy, unzip, and regedit commands executed.

Good luck. Thanks,

I didn't know that, and it wasn't simple to find some examples of the FC command.

The logic:

There is a library for a programm on the network, wich is updated by only 1 PERSON. The other 8 users have to download it wenn it is updated. So the file only needs to be copied, UNZIPPED and registered if the file on the netwerk is different to the file on the computer. It can happen that the file is not updated for several months, then it isn't neccisarily that it copy's and unzips at startup.



Discussion

No Comment Found