Remembered network connections in a batch file
Posted: 21 Mar 2010 21:35
I have a batch file used by over 40 people to update a folder on their Laptop. The source folder is stored on a server and whenever the users come into the office and plug in to the network they can run the batch file to update the folder on their laptop.
The batch file uses the NET command to connect to a network folder and then runs XCOPY with various switches to only copy anything new. This works well in most cases.
In the batch file I have the command "NET USE Z: \\192.168.1.1\DATA". Some of the users already have Z: mapped to a different network location and as such the batch file will display a message "The local device name has a remembered connection to another network resource" and does not connect. As a result it does not copy any of the updated files.
Is there a way of using an IF command to do something like ....
Or some other way of doing it.
I do not want to remove any remembered connections from anyones computers.
Everyone is running Windows XP.
If that is not clear enough or more information is required I am happy to supply more info.
Thanks.
The batch file uses the NET command to connect to a network folder and then runs XCOPY with various switches to only copy anything new. This works well in most cases.
In the batch file I have the command "NET USE Z: \\192.168.1.1\DATA". Some of the users already have Z: mapped to a different network location and as such the batch file will display a message "The local device name has a remembered connection to another network resource" and does not connect. As a result it does not copy any of the updated files.
Is there a way of using an IF command to do something like ....
Code: Select all
IF Z: has a remembered connection to \\192.168.1.1\DATA
...
Reconnect Network Drive to Z: using NET command
set ServerFolder=Z:\UPDATES
...
IF Z: has a remembered connection to[b] [i]SOME OTHER ADDRESS[/i][/b]
...
Connect network drive to Y: using NET command
set ServerFolder=Y:\UPDATES
Or some other way of doing it.
I do not want to remove any remembered connections from anyones computers.
Everyone is running Windows XP.
If that is not clear enough or more information is required I am happy to supply more info.
Thanks.