Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

What is this saying?

Posted on 2013-06-05
5
Medium Priority
?
203 Views
Last Modified: 2013-06-05
I am working a batch file that will get a count of all of the files in a folder that are 25 days old and newer. After internet searching I have found this:
setlocal
set "dd=%date:~0,2%"
set "mm=%date:~3,2%"
set "yy=%date:~-2%"
xcopy * /H /L /S /Q /Y /d:%mm%-%dd%-%yy%

My question is what does the numbers 0,2%, 3,2% & 2% indicate?
Thank you in advance for the education.
Lori
0
Comment
Question by:NLITech
[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
  • 3
5 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 2000 total points
ID: 39222635
They are the positional arguments of the variable %date%.

So, if you type
echo %date%
You will get back either the day abbreviation, and the date (depending on your regional settings), or just the date.

If the result is 06/06/2013, then dd will be equivalent to (starting at the first, cardinally zero position): "06".
mm would skip positions 0, 1 & 2 ("06/") and be assigned to the month ("06") with yy being set to the last two digits of the year (the dash states to count from the right side, stepping two positions backwards).
0
 

Author Closing Comment

by:NLITech
ID: 39222642
Thank you!!
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 39222644
Here's another example.  Assign variable "Food" to be value "Grapes".
Then show the first 2 characters, "Gr", the next two beginning at position 3, "pe", and finally the last 2 characters "es".

set Food=Grapes
echo %Food:~0,2%
result>>  Gr

echo %Food:~3,2%
result>> pe

echo %Food:~-2%
result>> es
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 39222647
Happy to help - thanx for the grade! :^)
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39222650
0,2 = starting at position 0 get the next two characters in the string (1 and 2)

3,2 = starting at position 3 get the next two characters in the string (4 and 5)

-2 = starting at the right of the string get the previous 2 characters

So based on the description this would be the European style date?

05/06/2013  

0,2 = 05 (dd)

3,2 = 06 (mm)

-2 = 13 (yy)


Day late and dollar short as usual.   :)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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