<http://www.netikka.net/tsneti/info/tscmd184.php>
Copyright © 2003-2012 by Prof. Timo Salmi  
Last modified Mon 23-Apr-2012 06:15:00
Welcoming the user from 54.227.51.103
On Mon 18-Dec-2017 22:21:31 server time

 
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 my tscmd.zip 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 companion.

Please see "The Description and the Index page" for the conditions of usage and other such information.



184} How do I map a network drive from the command line?

For example:
  @echo off & setlocal enableextensions
  net use s: \\192.168.1.2\COMP2_DTEXT /user:whoever
  xcopy /v/f C:\_D\MyTexts\MyFile.txt s:\
  dir s:\
  net use s: /delete
  endlocal & goto :EOF

The output might be e.g.
  C:\_D\TEST>CMDFAQ.CMD
  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.

References/Comments:
  Net use