Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mapping to network drive using .BAT file
Message
From
23/03/2004 11:39:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/03/2004 11:20:16
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00888895
Message ID:
00888902
Views:
17
>I need to map to a drive on another computer on the network. The network techs gave me the following batch file
>
> NET USE R: /D
> NET USE R: \\W0028109792\DATAWARE
>
>In the app's startup I do a
>
> RUN Yadayada.BAT
>
>Sometimes I see a DOS window and everything is great and other times I do not see a DOS window (and my users have to run the BAT file manually from a shortcut on the desktop). Most of my users are running Win XP. We are still using VFP 6 SP5.
>
>I am sure there is a better way of doing this in VFP (the politics of getting a login script are a problem at the moment).
>
>Thanks.
>
>Tim

I wouldn't use a bat file. You can connect from within VFP.
Declare integer WNetCancelConnection in WIN32API String lpName,short lForce
Declare integer WNetAddConnection in WIN32API ;
  string lpRemoteName,  ;
  string lpPassword,  ;
  string lpLocalName

*Add connection
WNetAddConnection("\\W0028109792\DATAWARE", "", "R:")

*Remove connection
*WNetCancelConnection("R:",0)
PS: WNetAddConnection2 and WNetCancelConnection2 supersedes and have more options for connections like dipslaying a prompt for username and pw for user to connect.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform