%time:~0,2% percent within the meaning of the detailed _dos/bat

Source: Internet
Author: User
Oh, the problem with the format of the time, the last two characters are milliseconds, most people do not use this, a few minutes a few seconds of the format is a bit more, so this is used to remove the last three characters, the preceding 0 means that the offset is 0 is the first character, starting from the first character, 3 means to remove the three characters. The previous 0 can also be omitted. I understand, do not know if I have said wrong, I hope not fraught. I do not know what I said so much you do not understand that the forum has such a post, you can search, lxmxn brother has also written such posts, as well as batch processing to explain such use. Be sure to have a good look when you are free.

Related help extracted from set/?:

%path:~10,5%
Expands the PATH environment variable and uses only the 11th in the extended result (partial
Shift 10) character starts with five characters. If no length is specified, the default
Value, which is the remainder of the variable value. If two digits (offset and length) are negative,
The number used is the environment variable value length plus the specified offset or length.
%path:~-10%
Extracts the last 10 characters of the PATH variable.
%path:~0,-2%
All characters of the PATH variable are extracted, except for the last two.
Example:
D:\>echo%time%
22:41:02.15
D:\>echo%time:~-3%
.77
D:\>echo%time:~0,-3%
22:41:19
D:\>echo%time:~,-3%
22:41:26
D:\>echo%time:~0,2%
22
D:\>set a=12345678
D:\>echo%a:~-5,-1%
4567
D:\>echo%a:~-5,-2%
456
D:\>echo%a:~-5,-5%
ECHO is in the open state.
D:\>echo%a:~-5,-6%
ECHO is in the open state.
D:\>echo%a:~-5,-4%
4

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.