批处理文件以使文件保持最新

发布于 2024-10-06 18:20:55 字数 341 浏览 0 评论 0原文

这听起来很简单,但由于某种原因我遇到了麻烦!

  • 将 \sharelocation\folder\file 与 c:\folder\file 进行比较
  • 如果文件不同,则替换本地文件

所以首先我需要一种方法从批处理文件访问 NetBIOS 共享,然后我需要一种方法来查看两个文件是否相同文件是相同的。 fc 是否返回错误级别?我可以使用 net 将 NetBIOS 位置添加为本地驱动器并以这种方式访问​​它吗?

在紧要关头,我愿意用编程语言(我知道大多数流行的语言)而不是批处理脚本来完成此操作,但由于各种原因,我更愿意这样做。

This sounds simple, but for some reason I'm having trouble!

  • Compare \sharelocation\folder\file to c:\folder\file
  • If the files are different, replace the local file

So first I need a way to access the NetBIOS share from a batch file, and then I need a way to see if two files are the same. Does fc return an ERRORLEVEL? Can I use net to add a NetBIOS location as a local drive and access it that way?

In a pinch I would be willing to do this in a programming language (I know most of the popular ones) rather than a batch script, but for various reasons I'd prefer to do otherwise.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵性 2024-10-13 18:20:55

您可以使用 UNC 语法访问共享上的文件:

\\servername\sharename\folder\file

这在批处理文件中与在命令提示符中同样有效,无需映射驱动器号。

You can access files on a share using UNC syntax:

\\servername\sharename\folder\file

This works equally well from a batch file as from a command prompt, no need to map a drive letter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文