is it possible to map a drive in the batch file without haveing to use the password in the command net use w: \\(server)\lantalk password:***** \user:***** is it possible to use the stored password within the server
2 Answers
is it possible to map a drive in the batch file without haveing to use the password in the command
Yes. I do this all the time on a shared network of Windows PCs where the computers have a common authentication arrangement or just trust each other. I find it is normally more convenient to create persistent connections than to run batch files though. Perhaps there are other use cases where a batch file would be useful.
is it possible to use the stored password within the server
No. Not in the sense I suspect you mean. People who create security arrangements intend that they cannot be trivially bypassed.
1You can ask for username and password while the .bat is running, withou saving them in the .bat file.
example:
set /p username=Insert username:
set /p password=Insert password:
echo =======================================
net use Z: /delete
net use Z: \\server.yourdomain.local\shared-folder %password% /user:yourdomain\%username%