Sign in to follow this  
Followers 0
dreamzboy

Open Directory From Mapped Drive

5 posts in this topic

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.

Share this post


Link to post
Share on other sites



rtm

DriveMapAdd()

or search for

RunReadStd()
, and look at "net use"

usual caveats about hiding usernames / passwords in scripts apply.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

Bump...I know someone knows but doesn't want to share. Posted Image

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0