Reputation: 1101
I am trying to open the dialog which is manually accessible through "Computer > Map Network Drive" on Windows 7. Is there any programmatic way to open it directly, e.g. with VBScript or PowerShell commands (not by firing mouse or keyboard events)? I am aware of net use ...
shell command, but I specifically want to display that dialog.
Upvotes: 3
Views: 1557
Reputation: 7046
Use rundll32.exe to pop the GUI from a script. It behaves just as if you clicked the button.
RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL Connect
Link included for additional tricks. Map Network Drive is #24 on the list.
http://www.robvanderwoude.com/rundll.php
Upvotes: 6
Reputation: 121699
Try WNetConnectionDialog:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa385433%28v=vs.85%29.aspx
or WNetConnectionDialog1:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa385436%28v=vs.85%29.aspx
Upvotes: 4