Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmitically map a network drive? 1

Status
Not open for further replies.

culleoka

Programmer
May 16, 2002
85
0
0
US
I have an app that needs to be mapped to a server 8 miles away. My problem is the shared folder on the server has a space in the folder name.
The 'Net Use' command below does not work.
I have also tried 'Benchs~1', 'Bench ~1'.
I am working in VFP 5.0 and the app will be run on Windows NT 4.0, Windows 95, Windows 2000 and Windows XP machines.
Is there another way to map to a drive, programmitically?

If .NOT. File("W:\Amdf.dbf")
Messagebox("You have lost your network connection"+CRLF+" I will try to reconnect",48,"Network Error")
Run Net Use W: \\ServerName\Bench Stock
EndIf
Thanks in advance for any help

Pat
 


Code:
oNet = CreateObject('WScript.Network')    
oNet.MapNetworkDrive('I','\\myserver\my Files',.T.,'mike','password')

or
Code:
 Run Net Use W: "\\ServerName\Bench Stock"
In quotes.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks Mike!
oNet.MapNetworkDrive...... worked like a charm!
For some reason the Net Use command worked also, from the Command Prompt.
It would not, however, connect from VFP 5.0.
I don't know what the deal is there, but the other tip worked great, so I am happy!
Thanks again!
Pat
 


I forgot. A star for you!

Thank you, glad it worked out for you.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Take a look at faq184-2343

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top