1. System Help C:\>date/?
Displays or sets the date.
Date [/T | date]
Just type Date without arguments, you can display the current date setting, and prompt
You enter a new date. Press ENTER to keep the original date.
If the command extension is enabled, the DATE command supports/T command options; the command option tells
The command prints only the current date, but does not prompt for a new date.
2.data/t Parameter Description
This parameter outputs the current date, for example:
c:\>date/t
2002-10-28 Monday
This date format may be different from the date format in the environment variable, such as
C:\>echo%date%
Monday 2002-10-28
With the for command, you can combine different expressions, such as:
c:\>for/f "tokens=1,2"%a in (' date/t ') do set date=%a
C:\>set date=2002-10-28
What this statement does is to remove the part that contains no weeks in the date/t.
We can draw the same result with simpler commands, such as:
C:\>echo%date%
Monday 2002-10-28
C:\>echo%date:~4,10%
2002-10-28
If you want to create a date folder or file name in a batch, you can simply do it, such as
C:\>mkdir%date:~4,10%
C:\>dir 2*
The volume in drive C is a local disk
The serial number of the volume is 402a-3a7e
This is useful for some automated operations in Oracle.
As you can see, with the combination of simple DOS commands, we can do a lot of seemingly complex things, just our thinking
Not always able to get there.
3. About the format of%date:~4,10%
The meaning of this command is to take the 4-10 middle character in the output of date.
For different machines, there may be different time formats, which can be set in the Control Panel.
You can view the current settings by using the Echo command, such as:
C:\>echo%date%
Monday 2002-10-28
Of course, we can also take the value of the week:
C:\>echo%date:~0,3%
Monday
Of course, you can also come from different directions:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.