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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing network share

Status
Not open for further replies.

vdeveloper

Programmer
Aug 5, 2000
42
IN
Hi all

I would like to know how to access a password protected network share through code. Im building an app which runs a backup process to a specific folder on the server (password protected). My app knows the password but the folder should not be accessible to other users through windows.

What exactly is the syntax to access the share path by giving a password ?

Thanks in advance

Ravi
 
Hi

Method1:
********
oNet = CREATEOBJECT('WScript.Network')
oNet.MapNetworkDrive("S:","\\myServer\myBack",.f.,"userName","Password")
** do your work
onet.RemoveNetworkDrive("s:",,.f.)


Method 2:
***********
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, STRING cAction, STRING cFileName, ;
STRING cParams, STRING cDir, INTEGER nShowWin

=ShellExecute(0,"RUN","NET", ;
"USE H: \\Server\Back /User:myUser password /YES","",0)

** your other commands to backup and then ..

=ShellExecute(0,"RUN","NET", ;
"USE H: \\Server\Back /D /YES","",0)

:)


____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
Merry Christmas & Happy New Year
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top