Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
i want to check "\\tp-pc\lab" is already share or not in client pc by CMD? before i make map network drive.
Posted

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
 
Share this answer
 
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.
 
Share this answer
 
Comments
virusstorm 19-May-15 15:57pm    
Just and FYI, it is generally considered bad practice to test that something exists by trying to create it. The resulting error can have undesired effects.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900