Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mapping a network *folder* programmatically
Message
From
11/05/2017 15:42:07
 
 
To
11/05/2017 15:29:23
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
01651049
Message ID:
01651052
Views:
62
>Hi,
>
>You can map a network *share* to a drive letter with WSH using the MapNetworkDrive method. objNetwork.MapNetworkDrive(strLocalDrive, strRemoteShare, [persistent], [strUser], [strPassword])
>
>But I want to map a network *folder* to a drive letter.
>You can do it from Windows Explorer by highlighting the folder and clicking Easy Access > Map as Drive.
>You can also do it from the command line with NET USE because it allows you to add a "volume" to form the complete path that you want to map "\\ComputerName\ShareName\Volume"
>--> net use [{devicename | *}] [\\computername\sharename[\volume] [{password | *}]] [/user:[domainname\]username] [/user:[dotteddomainname\]username] [/user:[username@dotteddomainname] [/home {devicename | *} [{password | *}]] [/persistent:{yes | no}] [/smartcard] [/savecred] [/delete] [/help] [/?]
>
>Is there a windows-native way to do this?

I haven't tested it, but I would think WSH and NET USE would use the same underlying protocols. In the WSH call have you tried adding your "Volume" path to strRemoteShare? It may or may not require a trailing backslash "\", you might want to try it both ways.

If you're using it a lot, and you have control over the server you might want to create another share that points directly to the path you need.

For lurkers, the CMD-line SUBST command is handy for mapping drive letters to *local* paths.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform