Connect to a network drive programmatically

  1. Edit in text editor, such as notepad
  2. Save as .bat

echo Connecting to a network drive, please wait

net use Z:/delete

net use Z:\\(ip address) /user: (username) (password)