How to map a network drive from windows command prompt

September 26th, 2009 by Giridhar | Posted under Tips & Tools, Windows.

How to map a network drive from windows command prompt

I had a daily requirement of copying few files and folders to few network folders, so for that purpose , I need to clean those folders daily and then copy the files. It was time consuming to go to each folder and delete contents so I used following script.

net use z: “\\system_name\folder\subfolder1\subfolder2\”

Above command will map a network drive as z: for the specified network folder.

Z:
rd /s/q d1
mkdir d1
rd /s/q d2
mkdir d2
rd /s/q d3
mkdir d3
rd /s/q d4
mkdir d4

These will remove the folder from that network drive and recreate the folder.

Tags: , ,

Have any comments?