It is the same as going to command prompt and type net use. U just put the commands into a text file and save that file as .bat
Example:
net use z: //computer2
put the commands into a text file and save the file as a .bat file.
If u are still in doubt, u can read up on "net use" commands and bat files.