检查共享文件夹是否已经在cmd中共享? [英] check share folder is already share or not in cmd?

查看:383
本文介绍了检查共享文件夹是否已经在cmd中共享?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过CMD检查\\tp-pc\lab是否已经在客户端PC中共享?在我制作地图网络驱动之前。

i want to check "\\tp-pc\lab" is already share or not in client pc by CMD? before i make map network drive.

推荐答案

可能你正在编写一个批处理文件?是吗?

如果是,您可以使用If Exist命令,例如:



Probably you are writing a batch file? Are you?
If yes, you can use "If Exist" command like:

If Exist \\tp-pc\lab echo it exists





希望有帮助



Hope that helps


谢谢你的帮助。现在我找到了解决方案。通过使用如下的bat文件脚本:



rem测试连接到共享文件夹

net use \\computer-name \ folder -name / user:用户名密码

rem我们将检查错误,知道是否可以连接

如果不是errorlevel 1(net use x:\\computer-name \ _文件夹名称/用户:用户名密码)



您需要密码保护共享。如果你把它关闭并给予每个人许可的文件夹共享,你只能如果存在。



我希望这能帮助像我这样的人。现在这是我工作场所的解决方案。
thank for help.now i found the solution. by using bat file script like below:

rem test connect to share folder
net use \\computer-name\folder-name /user:username password
rem we will check error to know can connect or not
if not errorlevel 1 (net use x:\\computer-name\folder-name /user:username password)

you need this for "password protected sharing". if you turn it off and give folder share with everyone permission, you can us only "if exist".

i hope this help someone like me. now this is the solution in my workplace.


这篇关于检查共享文件夹是否已经在cmd中共享?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆