Re: dos batch programmer help!!



In article <5tv2c29gdjoq9v5f1i0f7fbiqlmb393vem@xxxxxxx>
tdavis@xxxxxxxxxxxxxxxxxxxx "Ted Davis" writes:

On Fri, 21 Jul 2006 19:10:25 +0000 (UTC), pete@xxxxxxxxxxxxxxxxxx
wrote:

[ much rubbish :-( ]

vol | find "Serial"

returns the volume serial number as a string. That's what most people
seem to mean by "HD serial number". I'm pretty sure DOS 6.2 had that.

It does indeed -- I'd forgotten about VOL (and missed it in the
original post)

I would simply make the volume label indicate the day, and test for
that with a FIND command.

Alternatively [aimed at the Assaf M] try the batch below:

HBACKUP.BAT:
============
@echo off
REM Set up your two serial numbers here and ensure dir C:\TEMP\ exists
REM [test assumes the two H: drives have s/ns ABCD-1234 and ABCD-5678]
set disk1=ABCD-1234
set disk2=ABCD-5678
REM FIND returns errorlevel 0 if "text" is found, 1/2 if not found/error
:: ------------
vol h: | find "%disk1%" >nul
if errorlevel 1 goto otherdisk
REM == we found this disk s/n
type c:\temp\lastrun.txt | find "%disk1%" >nul
if errorlevel 1 goto backup_OK
echo Wrong disk(1) in H: -- swap it to allow backup to continue!
goto end
:: ------------
:otherdisk
REM == found the other disk s/n
type c:\temp\lastrun.txt | find "%disk2%" >nul
if errorlevel 1 goto backup_OK
echo Wrong disk(2) in H: -- swap it to allow backup to continue!
goto end
:: ------------
:backup_OK
REM == do your backup stuff here
echo Doing backup...
REM
REM == and update the "lastrun" file
vol h: | find "Serial" >c:\temp\lastrun.txt
:end
set disk1=
set disk2=
echo.
=============

Apologies for the bad info.
Pete
--
"We have not inherited the earth from our ancestors,
we have borrowed it from our descendants."
.



Relevant Pages

  • Re: Batch ntbackup to external hard drives (new version - Sept 2006)
    ... Below is a new version of the backup script that I posted to USENET ... external hard drives, such as those available from AcomData and others). ... echo Runs a backup to two external hard drives and logs progress and errors ... rem 1) Edit the Script Customizations ...
    (microsoft.public.windows.server.general)
  • Re: Backup bat file
    ... > trying to use a bat file to make the backup run and backup directly ... tape library, media type, etc.... ... rem you'll need sleep.exe from the resource kit. ... echo You may check the attached log to verify that it was successful. ...
    (microsoft.public.win2000.general)
  • Robocopy fails sporadically
    ... if errorlevel 16 echo FATAL ERROR on BACKUP of %~n0's DATA>> ... if errorlevel 8 echo FAILED COPIES on BACKUP of %~n0's DATA>> ...
    (microsoft.public.windows.server.general)
  • [SLE] Bat files in Linux
    ... In Windows I do this with a bat file that looks like the sample below. ... ECHO Backup Menu ... ECHO A. Flash Drive Backup J: ... IF /I '%Choice%'=='A' GOTO ItemA ...
    (SuSE)
  • Re: Command line FTP help
    ... rem Version 1.0 ... if ==GOTO NOPARAM1 ... echo An error occured whilst encrypting the file>> %log% ... > rem This part of the program encrypts the input file and produces an ...
    (microsoft.public.win2000.networking)