A DOS Command To Map A Network Drive

Just a quick post with DOS commands to map a network drive connecting as a specific user and logging the results.

echo Start %date% %time% >> D:\logs\drivemap.txt
net use z: /delete /yes >> D:\logs\drivemap.txt
echo Mid %time% >> D:\logs\drivemap.txt
net use z: \\10.10.10.10\INVOICEFILES /user:USERNAME PASSWORD /persistent:yes >> D:\logs\drivemap.txt
dir z: >> D:\logs\drivemap.txt
echo End %time% >> D:\logs\drivemap.txt

This is something we did for a project a while back and want to keep a note for future.

Leave a Reply