WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Network Related

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

List Sharenames that Match the Resource Path

 Keywords: wntShareInfo wntShareList wntGetShareName list get share sharename drive path resource  

#DefineFunction udfwntGetShareName(path)
   ; Load the Win32 Network extender
   AddExtender( "wwwnt34i.dll" )
   ; Get a list of disk drive & administrative share names
   list = wntShareList( "", 1 | 16, 0 )
   sharelist = "" ; List variable to store of list of share namse
   ; Grab the resource path for each sharename
   For xx = 1 To ItemCount( list, @TAB )
      sharename = ItemExtract( xx, list, @TAB )
      ; Get the resource path of the share
      resource = wntShareInfo( "", sharename, 0 , 1 )
      ; Compare the resource path to the path the user passed. (compare lowercase strings)
      If StrLower( path ) == StrLower( resource )
         ; Build delimited list of sharenames that match the resource path
         If sharelist == ""
            sharelist = sharename
         Else
            sharelist = @TAB : sharename
         EndIf
      EndIf
   Next
   Return sharelist
#EndFunction

mydrive = 'C:\'
result = udfwntGetShareName(mydrive)
AskItemlist('Sharenames for resource path: ': mydrive, result, @TAB, @UNSORTED, @SINGLE)
Exit

Article ID:   W18377
Filename:   List Sharenames that Match the Resource Path.txt
File Created: 2009:11:18:09:08:54
Last Updated: 2009:11:18:09:08:54