Solved

DOS Command - Parsing File on today's date

Posted on 2010-11-17
3
603 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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