Solved

DOS Command - Parsing File on today's date

Posted on 2010-11-17
3
594 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
Comment Utility
7-zip  filename %DATE%

0
 
LVL 10

Expert Comment

by:jramsier
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

6 Experts available now in Live!

Get 1:1 Help Now