Re: Set Day of week problems...

From: JediKnight2 (JediKnight2_at_gmail.com)
Date: 02/24/05

  • Next message: Lane Friesen: "Web-based operating system - a new approach"
    Date: 23 Feb 2005 18:15:53 -0800
    
    

    Thanks...what I am trying to do is use this with another script with
    xcopy so that files can be backed up by day...so if its Mon it should
    backup to a folder called Mon...

    mensanator@aol.com wrote:
    > JediKnight2 wrote:
    > > I am trying to set a variable day for the day of the week...
    > >
    > > @echo off
    > > ECHO.|DATE|FIND "is" /i > temp.bat
    > > echo set day=%%3 > current.bat
    > > call temp
    > > del current.bat
    > > del temp.bat
    > >
    > > That is the batch that I am using...basically I want it to make a
    > > directory for the day of the week..I know that I need to add the md
    > > %day% line but it doesnt work??
    >
    > Possibly because DATE prompts for a new date and it's waiting
    > for you to hit <Enter>.
    >
    > DATE /T will return just the date without prompting:
    > Wed 2/23/2005
    >
    > If you actually try to make a directory with that name, you'll
    > get a "Wed 2" directory with a "23" subdirectory with a "2005"
    > subdirectory. If you change the date seperator from the control
    > panel to "_", the date will print as "Wed 2_23_2005".
    >
    > Try this, start by making a file with the MD command. This file
    > must NOT have a cr-lf at the end. To create this file type
    > (from a command prompt)
    >
    > COPY CON DIRCMD.TXT
    > MD "^Z
    >
    > That's a control-Z at the end. It closes the file without
    > adding a cr-lf. Now create the following batch file
    >
    > @echo off
    > ECHO .| copy dircmd.txt temp.bat
    > ECHO .| date /t >> temp.bat.
    > call temp
    >
    > This creates a copy of the DIRCMD.TXT file and appends the
    > date to it. I called my batch file T.BAT and here's how it
    > works:
    >
    > H:\test>dir
    > Volume in drive H has no label.
    > Volume Serial Number is 8CCF-0740
    >
    > Directory of H:\test
    >
    > 02_23_2005 07:54p <DIR> .
    > 02_23_2005 07:54p <DIR> ..
    > 02_23_2005 07:37p 4 dircmd.txt
    > 02_23_2005 07:40p 90 t.bat
    > 2 File(s) 94 bytes
    > 2 Dir(s) 38,698,098,688 bytes free
    >
    > H:\test>t
    > 1 file(s) copied.
    > H:\test>dir
    > Volume in drive H has no label.
    > Volume Serial Number is 8CCF-0740
    >
    > Directory of H:\test
    >
    > 02_23_2005 07:55p <DIR> .
    > 02_23_2005 07:55p <DIR> ..
    > 02_23_2005 07:37p 4 dircmd.txt
    > 02_23_2005 07:40p 90 t.bat
    > 02_23_2005 07:55p 21 temp.bat
    > 02_23_2005 07:55p <DIR> Wed 02_23_2005
    > 3 File(s) 115 bytes
    > 3 Dir(s) 38,698,098,688 bytes free


  • Next message: Lane Friesen: "Web-based operating system - a new approach"

    Relevant Pages

    • Re: Obtain drive letter assignment of CD/DVD drive?
      ... the Line references were not recognized ... You defined %Label% yourself in the second line! ... your version of the batch file as an attachment to your ... echo No %Label% found ...
      (microsoft.public.windowsxp.general)
    • Re: Obtain drive letter assignment of CD/DVD drive?
      ... did not come up with a "%Label% variable ... echo No %Label% found ... Line8 goto Exit ... Do not retype this batch file - use copy & paste instead! ...
      (microsoft.public.windowsxp.general)
    • Re: Obtain drive letter assignment of CD/DVD drive?
      ... Line7 echo No %Label% found ... Line8 goto Exit ... Line11 echo The %Label% is mounted on drive %drive%. ... Would like to process a batch file to run a series of programs and/or ...
      (microsoft.public.windowsxp.general)
    • Re: Obtain drive letter assignment of CD/DVD drive?
      ... Line7 echo No %Label% found ... Line11 echo The %Label% is mounted on drive %drive%. ... Would like to process a batch file to run a series of programs and/or ... subsequent batch file command lines. ...
      (microsoft.public.windowsxp.general)
    • Re: Persisting env vars in cmd windows
      ... The help text for the command you question goes like this: ... format by typing this: echo %date% ... If you don't then the batch file will fail. ... echo:: ERROR ERROR ERROR ERROR ...
      (microsoft.public.win2000.general)