Re: Set Day of week problems...
From: JediKnight2 (JediKnight2_at_gmail.com)
Date: 02/24/05
- Previous message: Charles Richmond: "Re: A packing problem"
- In reply to: mensanator_at_aol.com: "Re: Set Day of week problems..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Charles Richmond: "Re: A packing problem"
- In reply to: mensanator_at_aol.com: "Re: Set Day of week problems..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|