Page 1 of 1

Check If Network Share Exists

Posted: 04 Oct 2011 18:37
by alleypuppy
Hello. I am trying to figure out if a network share exists through CMD. I had a few ideas of how to do this, but all seem to fail. First I tried

Code: Select all

C:\>IF EXIST \\[computername]\[share[$]] ECHO Exists
but this does not work. Then I tried connecting to just the computer (no share name) using NET USE and then changing the directory to the share.

Code: Select all

C:\>NET USE * \\[computername]
C:\>CD [share]
This also did not work since I need to specify a share name within the NET USE command to connect to that computer. The reason I don't want to use

Code: Select all

C:\>NET USE * \\[computername]\[share[$]]
is because it will prompt me for a username and password regardless of what is specified for the share, which is what I want to avoid.


Thanks for any help!

Re: Check If Network Share Exists

Posted: 08 Oct 2011 11:31
by Ed Dyreen
'
You may ping a computer and if you have the rights you are allowed to see the share.
If you lack the rights you will be prompted to logon !

Code: Select all

C:\PROFSYS\ADMIN>net view \\192.168.1.14
Gedeelde bronnen op \\192.168.1.14



Sharenaam   Type    Gebruikt als  Opmerking

-------------------------------------------------------------------------------
COMP        Schijf  S:
ED-SERV-0   Schijf  W:
SharedDocs  Schijf
De opdracht is voltooid.

Re: Check If Network Share Exists

Posted: 08 Oct 2011 21:15
by alleypuppy
Ed Dyreen wrote:'
You may ping a computer and if you have the rights you are allowed to see the share.
If you lack the rights you will be prompted to logon !

Code: Select all

C:\PROFSYS\ADMIN>net view \\192.168.1.14
Gedeelde bronnen op \\192.168.1.14



Sharenaam   Type    Gebruikt als  Opmerking

-------------------------------------------------------------------------------
COMP        Schijf  S:
ED-SERV-0   Schijf  W:
SharedDocs  Schijf
De opdracht is voltooid.

Thank you, but I actually solved my problem myself earlier today and I was just about to post on my thread saying that I have resolved my problem. But thanks anyway!