If you have a script used to map a network drive and need to use credentials for what ever reason, i.e. the network share isn’t on a domain, you can use a simple script in your batch file:

@echo off

rem The line below will delete any existing mapping to the x:
net use x: /delete

rem The line below will remap the x: drive to the \\server\share
net use x: \\server\share /USER:COMPUTER\User password

exit