Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mapped Drives not recognized in Windows 10
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01634105
Message ID:
01634344
Views:
60
>>>I agree, and unless Windows Scripting is not installed, it's really easy.
>>>
>>>
>>>wshshell=createobject('wscript.shell')
>>>wshnetwork=createobject('wscript.network')
>>>wshnetwork.MapNetworkDrive('p:','\\servername\sharename',.f.,'Username','Password')
>>>Release wshshell
>>>Release wshnetwork
>>
>>You can also do it just with a RUN command so need for scripting host:
>>
>>
>>************************************************************************
>>*  MapNetworkDrive
>>****************************************
>>***  Function: Maps a network drive by shelling out 
>>***    Assume:
>>***      Pass: lcDrive     - i:
>>***            lcSharePath - UNC path to map \\server\share
>>***            lcUsername  - user name (if empty uses current creds)
>>***            lcPassword  - password
>>***    Return: nothing
>>************************************************************************
>>FUNCTION MapNetworkDrive(lcDrive, lcSharePath, lcUsername, lcPassword)
>>
>>IF RIGHT(lcDrive,1) != ":"
>>   lcDrive = lcDrive + ":"
>>ENDIF
>>   
>>lcRun = [net use ] + lcDrive + [ "] + lcSharePath + [" ]
>>
>>IF !EMPTY(lcUsername)
>>  lcUserName = ["]  + lcPassword + [" /USER:"] + lcUsername + ["]
>>ELSE
>>  lcUserName = ""
>>ENDIF
>>
>>lcUsername = lcUserName + " /persistent:yes"
>>
>>lcRun = lcRun + lcUsername
>>RUN &lcRun 
>>
>>*** Check to see if the folder exists now
>>RETURN DIRECTORY(lcDrive)
>>ENDFUNC
>>*   MapNetworkDrive
>>
>
>I prefer to use ShellExecute, but as long as it works..! :-)

Guys - I can not stress enough that all of this is a complete waste of time until he fixes his permissions problem.
ICQ 10556 (ya), 254117
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform