Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

passing current date into a batch file command in Win2K

11 views
Skip to first unread message

Gary Garnier

unread,
Jul 9, 2004, 5:19:18 PM7/9/04
to
(I couldn't find alt.msdos.batch.2000 - my apologies if it's a major
gaffe to post here...)

I want a batch file that will automatically create a list of all files
created "today", every day.

If it was just a matter of writing this to run today, I'd use:

dir c:\ /s | find 07/09/04 > filestoday.txt

but I want to put this in my shutdown menu so that it will happen
automatically as I am walking to the parking lot.

I believe that "set today=%date%" will create a variable containing
today's date, but I don't know how to make this value the argument of
the "find" command.

Any help would be appreciated.

Paul R. Sadowski

unread,
Jul 9, 2004, 5:52:32 PM7/9/04
to
"Gary Garnier" <ggar...@yahoo.com> wrote in message
news:3282f8c.04070...@posting.google.com...

> (I couldn't find alt.msdos.batch.2000 - my apologies if it's a major
> gaffe to post here...)
>
> I want a batch file that will automatically create a list of all files
> created "today", every day.
>
> If it was just a matter of writing this to run today, I'd use:
>
> dir c:\ /s | find 07/09/04 > filestoday.txt

dir c:\ /s | find "%DATE:~4%" > filestoday.txt

guard

unread,
Jul 12, 2004, 6:10:17 AM7/12/04
to
"Gary Garnier" <ggar...@yahoo.com> wrote in message
news:3282f8c.04070...@posting.google.com...

See (http://TheSystemGuard.com/MtCmds/GetValue/GetLogDate.htm).

The variable %#LogDate% will CONSISTENTLY be yyyymmdd.

In your specific case:

CALL ntlib.cmd /Quiet /Init
DIR C:\ /s | %.Find% %#LogDate:~4,2%/%#LogDate:~6,2%/%#LogDate:~2,2%

*******

%.Find% is the ExactName Mount/\Command for Find.exe. It provides
additional reliability by specifying EXACTLY what command you want to run.
See (http://TheSystemGuard.com/MtCmds/ExactName)

All of the above are FREE with the Advanced Command Library.
(http://ntlib.com)

*******

-tsg

/-----------------+---------------+----------------------\
| COMPATIBILITY | CLARITY | SPEED |
| Write code ONCE | Make it clear | THEN...Make it fast! |
\-----------------+---------------+----------------------/
400+ command-line resources using ONLY native NT commands!
(http://TheSystemGuard.com/default.asp#MasterCommandList)


0 new messages