Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mapped Drives not recognized in Windows 10
Message
 
À
05/04/2016 15:58:42
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:
01634340
Vues:
79
>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
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform