Can bat file to map drives mask the passwords

October 5, 2010 at 15:55:34
Specs: Windows XP
I know the net use command needed to map a drive. But in the statement, I dont want the password to be visible. Is there a command that will mask that password. I do not want user interaction. I want to put the password in, but dont want anyone to see it.

See More: Can bat file to map drives mask the passwords

Report •

November 8, 2010 at 19:50:36
Try something like this:

1.) Create a file and type on it the hostname or IP-Address, username and password on one line. Example: zeus or danny !daNny!2010
2. Name the file "p" (just p without specifying the file type)

Now, create the batch file and name it whatever you want as follows:

==================== Start (Mapping.bat) =======================
@echo off
title Mapping Drives
FOR /F "tokens=1-3 delims= " %%i IN (p) do (
set host=%%i
set ur=%%j
set pd=%%k
IF Exist Z: net use /del Z: /Y
net use Z: \\%host%\share %pd% /USER:%ur% /P:NO
==================== End (Mapping.bat) =========================


The /P:NO is optional and means no persistent mapping. This attribute could be switched on with /P:YES. Again it is exactly the same as writing /persistent:no or /persistent:yes.

Each time the host boots up, the drives could be mapped automatically (/P:YES) or not (/P:NO)

I always prefer to write protect and hide the "p" file. In this way, the file is not only invisible but also protected from accidental deletion

Report •
Related Solutions

Ask Question