Page 1 of 1

Mapping the shared folders

Posted: 09 Jul 2017 03:16
by balubeto
Hi

In Windows PE/RE of Windows 10 v1704 (DOS command prompt), what is the procedure to find the shared folders on the network and how do I map them?

Thanks

Bye

Re: Mapping the shared folders

Posted: 09 Jul 2017 03:43
by aGerman
Most likely NET USE (execute NET HELP USE to get help).

E.g.

Code: Select all

net use X: /delete /yes
to disconnect if the drive X: was still connected (option /yes is not documented, it forces silent disconnection).

Code: Select all

net use X: "\\servername\share" /persistent:no
to connect drive X: where "servername" can also be an IP address. If "share" contains a drive letter on the server then replace the colon with a Dollar sign (e.g. C$ instead of C:).

Steffen

Re: Mapping the shared folders

Posted: 10 Jul 2017 12:33
by SIMMS7400
If you're worried about drive letters, use this piece of code to find an available one:

Code: Select all

SETLOCAL ENABLEDELAYEDEXPANSION

FOR %%D IN ( b d e f g h i j k l m n o p q r s t u v w x y z ) DO (

   IF NOT EXIST %%D:\ (
      SET MD=%%D
      NET USE !MD!: "%DRIVE1%" /USER:%CREDS%
      GOTO BREAK
   )
)
:BREAK

:: Put code here to be acted on related to the recently mapped drive

NET USE %MD%: /delete

Re: Mapping the shared folders

Posted: 10 Jul 2017 12:44
by Compo
SIMMS7400 wrote:If you're worried about drive letters, use this piece of code to find an available one:

<SNIP />

If you type an asterisk, *, instead of a drive letter it will assign the next available drive letter.

Code: Select all

NET USE *