I have the following bat file. I did not create it, but got it off of the MS scripting site.
We are going to migrate data from an old nt server to a new server. The company has been using this server for about 10 years and everybody has one or more drives mapped to it.
This file re-maps the users current drives to the new server correctly.
However in testing it out, on some users, for some reason the file will stop and because of "open files or incomplete searches pending" it will ask for a y/n input form the users.
Is there anyone who can see where I should put the echo y| in the file so it will just disconnect/re-map that drive and continue running?
we have a vbs script that will re-direct all the shortcuts and links to the new path, but this has to run first.
+++++++++++++BAT FILE START+++++++++++++++++++++++
@echo off
echo /y
set OldName=\old_server
set NewName=\new_server
net use | find /i "%OldName%" > nul || goto :eof
for /F "tokens=2-3" %%a in ('net use ^| find "\"') do call :Sub %%a %%b
echo /y
goto :eof
:Sub
set DriveLetter=%1
if %DriveLetter:~1,1%==: goto Letter
:NoLetter
set ShareName=%1
call set ShareName=%%ShareName:%OldName%=%NewName%%%
net use %1 /d
net use
net use %ShareName%
net use
goto :eof
:Letter
set ShareName=%2
call set ShareName=%%ShareName:%OldName%=%NewName%%%
@echo on
net use %DriveLetter% /d
net use
net use %DriveLetter% %ShareName%
net use
@echo off
++++++++++++++++++++END OF BAT FILE++++++++++++++++
Software/Hardware used:
xp pro sp3. 2003 server dc
ASKED:
July 15, 2010 6:34 PM
UPDATED:
August 16, 2010 4:09 PM
Thank you.
Sorry for not seeing it sooner, this project got pushed over to the side. But now it’s back.
I’ll give it a go.