1

I'm trying to write a batch file to

  • Access \sharelocation\folder\file
  • Compare that file to c:\folder\file
  • If the files are the same, run the local file.
  • If the files are different, replace the local file and run the new local file.

I'm stuck on the first part. Is there a good way to do this?

Maybe I can use net to map the share to a fixed letter if not already mapped then use fc /b?

1 Answer 1

1

Something along these lines:

The whole script should be:

net use x: \\share\location
fc c:\folder\file x:\folder\file
if errorlevel 1 goto filesDiffer
:noDifferences
echo Do something when there are no differences
goto theEnd

:filesDiffer
echo Do something when there are differences

:theEnd
net use x: \\share\location /delete

Note you would have issues if x: is already mapped on the target machine. Use fc /b for binary comparison.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .