批处理文件遍历本地网络服务器上的文件 [英] Batch File Iterating through files on a local network server
本文介绍了批处理文件遍历本地网络服务器上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用此批代码打开存储在本地网络服务器上的各种文件:
I'm trying to open various files stored on a local network server with this piece of batch code:
for /f "tokens=*" %%G in ('dir /b /a:d "\\server\directory\*"') do %%G\setup.xml
但由于 dir \\server\目录
不起作用这样的代码就不会了。
我该怎么做?
but since dir \\server\directory
doesn't work so won't that piece of code.
How can I accomplish that?
谢谢你
推荐答案
您可以使用以下方式映射驱动器
You can map a drive using
net use X: \\server\directory
然后可以使用
and then you can change to that directory using
pushd X:
然后您可以在当前目录上运行批处理命令,当您完成操作并且文件不再使用时,可以使用以下命令删除驱动器
You can then run your batch command on the current directory, and when you are finished and the files are no longer in use, you can delete the drive using
net use X: /delete
这篇关于批处理文件遍历本地网络服务器上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文