Home page CMD C++ Hardware HTML i javascript Java Software SQL flag_united_kingdom flag_poland

CMD (Win7) - mounting network drives (net use).

Added: 2011-09-17

Work on multiple operating systems, often require the same configuration to work properly. Good example is the mounting of network drives in the system, to which the user must have access to.

You can do faster this operation, configure one system, and save the settings into a text file. Then modify the data, so that could be used in a script file.

Now a little about the commands. Displaying all network disk:

net use

Example mount network disk, for directory \\TEMP\setups, under the letter z:

net use z: \\TEMP\setups

You must know, how to remove the added drive, without prompting to confirm decision:

net use /d /y [letterOfRepertory]

Below is script:

Print Select
@echo off

net use > netuse.txt
set com=@echo off
@echo %com% > netuse.bat

for /f "tokens=1,2,3 skip=6 delims= " %%a in (netuse.txt) DO (
	for %%v in ("Disconnected" "OK" "RozˆĄczony") do (
		if /i "%%a" EQU "%%~v" (
			@echo Nosnik sieciowy: %%a %%b %%c
			@rem net use /d /y %%b >> netuse.bat
			@echo net use %%b %%c >> netuse.bat


If you find unintelligible text, write to me corrected words, please - lis.la(at)wp.pl