Wednesday, 20 November 2013

Microsoft: Mount Drive with Windows Command Line by Prompting User for Username and Password

The Windows command line below allows you to mount multiple drives by only prompting user to enter the username and password once. Before another user tries to mount the drives, the script will first unmount the previous mounted drives.


@echo ##############################################
@echo ##### Mount Drive Script by Andres Cheah #####
@echo ##############################################
@echo #####                                    #####
@echo ##                                          ##
@echo #                                            #
@echo off
net use x: /delete
net use z: /delete
set /p id=Please enter your username: %=%
set /p password=Please enter your password: %=%
net use x: \\fileserver1\Home %password% /user:domain1\%id%
net use z: \\100.18.30.2\Class %password% /user:domain2\%id%

Pause

No comments:

Post a Comment