Associate
- Joined
- 27 Feb 2006
- Posts
- 1,750
- Location
- Normanton
Im trying to write a bat file to map drives to my file server on login but im getting some problems this is what ive got
It works most of the time but im getting an error saying
"multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again."
How can I see what previous connections I am making as I don't think I am doing and stop them?
Cheers
Code:
@echo off
net use z: /delete
net use x: /delete
net use y: /delete
set "svrname=home"
set "usr=matt"
set "pwd=test"
for /f "tokens=2" %%# in ('net use^|find /i "\\%svrname%"') do net use %%# /delete>nul
net use Z: \\%svrname%\Media /user:%usr% "%pwd%">nul
net use X: \\%svrname%\Downloads /user:%usr% "%pwd%">nul
net use Y: \\%svrname%\Backup /user:%usr% "%pwd%">nul
It works most of the time but im getting an error saying
"multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again."
How can I see what previous connections I am making as I don't think I am doing and stop them?
Cheers