Solved

DOS Command - Parsing File on today's date

Posted on 2010-11-17
3
597 Views
Last Modified: 2012-05-10
I am trying to setup a DOS batch file to be able to run 7-zip on file in a folder.

I need to be able to run this 7-zip on today's date.

Example:

7-zip  filename "today's date"

How do I structure my script to only apply my 7-zip on Today's Date?
0
Comment
Question by:j4piper
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
Thommy earned 500 total points
ID: 34156517
7-zip  filename %DATE%

0
 
LVL 10

Expert Comment

by:jramsier
ID: 34156525
in command prompt you can add this to it: "%date:~10,4%-%date:~4,2%-%date:~7,2%"  it will create "2010-01-29"  Format it as you want.  You can move the 3 sections around to make a different format.
0
 
LVL 19

Expert Comment

by:Thommy
ID: 34156559
if you want to build your own date string...

check your date format by typing DATE

if your date format is for example 17/11/2010, you can built your own date string as follows


Set mm=%DATE:~3,2%

Set dd=%DATE:~0,2%

Set yyyy=%DATE:~6,4%



REM Built variable with own date format

set MyDate=%yyyy%-%mm%-%dd%



7-zip  filename %MyDate%

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now