批量访问NetBIOS位置/关联的脚本

我正在尝试写一个batch file

  • 访问\ sharelocation \文件夹\文件
  • 将该文件与c:\ folder \文件进行比较
  • 如果文件相同,则运行本地文件。
  • 如果文件不同,请replace本地文件并运行新的本地文件。

我被困在第一部分。 有没有一个好的方法来做到这一点?

也许我可以使用net共享映射到一个固定的字母,如果还没有映射然后使用fc /b

沿着这些线路的东西:

整个脚本应该是:

 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 

注意如果x:已经被映射到目标机器上,你将会遇到问题。 使用fc /b进行二进制比较。