Jump to content

Open Directory From Mapped Drive


 Share

Recommended Posts

Hello,

I have a simple noobie question. I've successfully mapped the network drive; however, I couldn't figure out how to automatically open that directory without having me browse to the directory that I just mapped.

For example, I mapped "\\computer-name\folder" (without a drive letter). The script successfully mapped it, but how do I get that folder to open once it's mapped? If I manually mapped the network drive from my computer, assigned a drive letter, entered my credential, and when I clicked finish, the drive/folder shows up. I wanted to do the same but through a script so I don't have to manually map the drive and enter my credential every time.

Thanks in advance for your help.

Link to comment
Share on other sites

rtm

DriveMapAdd()

or search for

RunReadStd()
, and look at "net use"

usual caveats about hiding usernames / passwords in scripts apply.

I've already looked at the DriveMapAdd feature. In fact, that's what I used right now and there's no mapped drive window pop up like the manual mapped drive.

How do you hide usernames/password? I never could figure that out.

Thanks!

Link to comment
Share on other sites

Why not just ShellExecute() the share...

Local $Result, $Mapping = '\\Server\Share'
$Result = DriveMapAdd('', $Mapping, 'UserName', 'password')
Switch $Result
    Case 1
        MsgBox(32, 'SUCCESS', 'Exit Code: ' & $Result)
        ShellExecute($Mapping, '', $Mapping, 'open')
    Case Else
        MsgBox(32, 'FAILURE', 'Exit Code: ' & $Result)
EndSwitch

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...