Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mapped Drives not recognized in Windows 10
Message
De
05/04/2016 16:05:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01634105
Message ID:
01634341
Vues:
67
>>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..! :-)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform