Results 1 to 6 of 6

Thread: Batch files

  1. #1
    alterego
    Guest

    Batch files

    This is a DOS question really, but it is being accessed via Win98...

    I'd like to write a batch file for backing up certain folders to a CD-R, and as there's room for the same operation several times over, it would be nice if it could automatically create a new folder for each set on each occasion. This could be named after the date, or sequentially or whatever - I don't mind, but I'd like the process to be as simple as possible.

    I've done a little batch file writing in the past, but mostly simple stuff with xcopy and the like. Any help greatly appreciated.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch files

    The best resource I have found for batch programming is <A target="_blank" HREF=http://www.ericphelps.com/batch/>Windows 95 / DOS 7 Batch Programming</A>

    A search at Google returned several results as well: <A target="_blank" HREF=http://www.google.com/search?q=Batch+File+Programming> Google: Query (Batch File Programming)</A>

    You're not looking for anything too difficult, but these resources should help you on your way...

    Hope that helps!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  3. #3
    alterego
    Guest

    Re: Batch files

    Many thanks DR. I was being a bit lazy...

  4. #4
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Palmyra, Virginia, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch files

    Back in the days when command lines and batch files made you a power user, ZDNET had wonderful batch file enhancement programs. I used one of those to grab the date and time, concatenate to a unique value and used it to create a (hopefully) unique file name.

    I dunno if they still have them online.

    -----Paul-----

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Batch files

    The batch file below will put the system date in different forms into environment variables which can be used to name files and directories. If I remember correctly, this batch file does work in Win 98 but not in anything after that since MS broke the undocumented feature that makes it work.

    <pre>@ECHO OFF
    REM
    REM WARNING - This batch file will not work in versions of MSDOS
    REM later than version 6.22 MS broke the undocumented
    REM feature that allows it to work.
    REM
    REM This batch file will create seven environment variables that have
    REM different parts of the current date in them. If today was January 24,
    REM 1995, then it would create the following environment variables:
    REM
    REM CDATE=Date in form mm-dd-yyyy (01-24-1995 for today)
    REM CMON=Month number (01 for today)
    REM CDAY=Day number in month (24 for today)
    REM CYR=Last two digits of the year (95 for today)
    REM CCENT=First two digits of year, or century number (19 for today)
    REM CDOW=Day of week (Tue for today)
    REM MMM=Month name (Jan for today)
    REM
    IF "%1" == "}{" GOTO NEXTC
    SET CDATE=
    SET CDOW=
    SET CMON=
    SET CDAY=
    SET CCENT=
    SET CYR=
    SET MMM=
    IF "%1" == "/R" GOTO XIT
    IF "%1" == "/r" GOTO XIT
    ECHO SET CDATE=%%4 >CURRENT.BAT
    ECHO.|DATE|FIND "Current">$$$CD$$$.BAT
    CALL $$$CD$$$
    DEL $$$CD$$$.BAT
    DEL CURRENT.BAT
    SET CS=
    Legare Coleman

  6. #6
    alterego
    Guest

    Re: Batch files

    What a star! Thank you so much...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •