批处理文件以使文件保持最新
这听起来很简单,但由于某种原因我遇到了麻烦!
- 将 \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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 UNC 语法访问共享上的文件:
这在批处理文件中与在命令提示符中同样有效,无需映射驱动器号。
You can access files on a share using UNC syntax:
This works equally well from a batch file as from a command prompt, no need to map a drive letter.