Jump to content

How to map a network drive using autoit


Recommended Posts

Link to comment
Share on other sites

or, if you realy wanna use "net use" check this: http://www.cezeo.com/tips-and-tricks/net-use-command/

example:

;before you launch this script, make sure that your C drive is shared as share name: C
#include <GUIConstants.au3>
#include <Constants.au3>
Opt("GUIOnEventMode", True)
$Form1 = GUICreate("net use", 166, 105, 193, 115)
$Button1 = GUICtrlCreateButton("create drive k:", 16, 8, 129, 30, 0)
$Button2 = GUICtrlCreateButton("delete drive k:", 16, 48, 129, 30, 0)
GUICtrlSetOnEvent($Button1, "createdrive")
GUICtrlSetOnEvent($Button2, "deletedrive")
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
GUISetState(@SW_SHOW)
Func createdrive ()
    Run(@ComSpec & " /c " & "net use k: \\127.0.0.1\c", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)
EndFunc
func deletedrive ()
    Run(@ComSpec & " /c " & "net use k: /DELETE", "", @SW_HIDE ,$STDERR_CHILD + $STDOUT_CHILD)
EndFunc
func _exit ()
    Exit
EndFunc
While 1
    Sleep(10)
WEnd
Link to comment
Share on other sites

Other question

If i Want to open

\\SERVER\Pathname with user and pass from local computer, without see the Window wich commands can i use ?

This is a shared directory of my server

What do you intend to do with this window that cannot be seen? You mean an explorer window?

Link to comment
Share on other sites

What do you intend to do with this window that cannot be seen? You mean an explorer window?

NO I Explain this

I have a local account on my computer, when I execute with "Start" - "Execute" shortcuts on WindowsXP

I enter the line "\\Server\Shared"

When I click on Enter

Windows ask me to login on the server with Domain Login and password

And give me access to this resource

Why can I acces with autoit commands to this resource without map a drive but using this method.

Do you understand my question ?

Thanks for replys

Link to comment
Share on other sites

hm try this method.

#include <Process.au3>
_RunDOS("net use x: /delete /yes > nul")
_RunDOS("net use x: \\Server\Shared yourpasswordhere /user:Administrator")
MsgBox( 0, "Done", "Network Up", 3)

Its also mapping a driveletter but at least your avoiding to type anything before access.

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...