Batch file to map main and backup drive

January 27, 2010 at 20:23:38
Specs: Windows NT server, 2GB
Hi, we have around some workstations connected to our server to send the results which have limitation to auto detect if mapped server is down.
I want to do a batch file, where it able to map during logon with following logic:
first logic:
map Z:\
1) to main server: em01:\results
and able to detect it is accessible (sometimes it looks like mapped but need to manually double key in to make it accessible)
2) if main is not accessible, map em02:\results
and able to detect it is accessible

or logic #2:

1. map z:\em01\results and y:\em02\results at logon
2. click a batch file to move the results:
- cd Z:\, move C:\ets\results\*.log to Z:\
write into a log, on sending til successfull sent.
if it is not successfully sent, then try Y:\, move C:\ets\results\*.log to Y:\
write into a log, on sending til successfull sent.

I'm new to batch file, hope some one can help.. thanks


See More: Batch file to map main and backup drive

Report •


#1
January 28, 2010 at 02:40:26
Untested:

@echo off

net use Z: \\em01\results
del Z:\test.tst
echo a> Z:\test.tst
if exist Z:\test.tst goto server1ok

net use Y: \\em02\results
del Y:\test.tst
echo a> Y:\test.tst
if exist Y:\test.tst goto server2ok

goto failure

:server1ok
echo Moving files to EM01
move /Y C:\ets\results\*.log Z:\ >> Z:\%COMPUTERNAME%_move.log
type Z:\%COMPUTERNAME%_move.log >> C:\move.log
goto :EOF

:server2ok
echo Moving files to EM02
move /Y C:\ets\results\*.log Y:\ >> Y:\%COMPUTERNAME%_move.log
type Y:\%COMPUTERNAME%_move.log >> C:\move.log
goto :EOF

:failure
echo.
echo Did not succeed to connect to either EM01 or EM02
goto :EOF


Report •
Related Solutions


Ask Question