Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index
This page is edited from the 1cmdfaq.txt faq-file contained in
command line interface (CLI) collection. That zipped file has much
additional material, including a number of detached .cmd script
files. It is recommended that you also get the zipped version as a
Please see "The Description and
the Index page
" for the conditions of usage and other such
184} How do I map a network drive from the command line?
@echo off & setlocal enableextensions
net use s: \\192.168.1.2\COMP2_DTEXT /user:whoever
xcopy /v/f C:\_D\MyTexts\MyFile.txt s:\
net use s: /delete
endlocal & goto :EOF
The output might be e.g.
The command completed successfully.
C:\_D\MyTexts\MyFile.txt -> S:\MyFile.txt
1 File(s) copied
Volume in drive S is COMP2_C
Volume Serial Number is E753-B1B6
Directory of s:\
11.03.2011 12:23 <DIR> .
11.03.2011 12:23 <DIR> ..
11.03.2011 12:33 34,062 MyFile.txt
1 File(s) 34,062 bytes
2 Dir(s) 38,304,260,096 bytes free
s: was deleted successfully.
The last message is slightly misleading because s: actually is not
deleted, but disconnected.