Note: After executing the date command in the cmd command line window of Windows, the value of this environment variable is
Then the meaning of each of the following operations is as follows: %date:~0,4% means that the pointer moves 0 bits to the right from left to right, and then extracts 4 characters starting from the position where the pointer is offset. The result is 2016 (year value) %date:~5,2% means that the pointer is offset by 5 digits from left to right, and then extracts 2 characters starting from the offset. The result is 11 (the value of the month) %date:~8,2 % means that the pointer is offset by 8 bits from left to right, and then extracts 2 characters starting from the offset. The result is 09 (the value of the day)
Another example: %date:~5% means that the pointer is offset by 5 digits from left to right, and then extracts all values %date:~-5% means that the pointer is offset in the opposite direction, starting from the rightmost end, offset Shift 5 bits, then extract all values to the left from the pointer.
Let’s look at the value of the time variable:
Then the meaning of each of the following operations is as follows: %time:~0,2% means that the pointer shifts 0 bits to the right from left to right, and then extracts 2 characters starting from the offset position of the pointer, and the result is the hour field value %time:~3,2% means that the pointer is offset by 3 digits from left to right, and then extracts 2 characters starting from the offset. The result is the minute field value %time:~6,2% means that the pointer is offset from left to right Offset 6 bits to the right, and then extract 2 characters starting from the offset. The result is the second field value
adb logcat > "%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%-%time:~3,2%- %time:~6,2%.txt"
The output is: 2016-11-09 15-40-16.txt
Note:

After executing the date command in the cmd command line window of Windows, the value of this environment variable is
Then the meaning of each of the following operations is as follows:
%date:~0,4% means that the pointer moves 0 bits to the right from left to right, and then extracts 4 characters starting from the position where the pointer is offset. The result is 2016 (year value)
%date:~5,2% means that the pointer is offset by 5 digits from left to right, and then extracts 2 characters starting from the offset. The result is 11 (the value of the month)
%date:~8,2 % means that the pointer is offset by 8 bits from left to right, and then extracts 2 characters starting from the offset. The result is 09 (the value of the day)
Another example:
%date:~5% means that the pointer is offset by 5 digits from left to right, and then extracts all values
%date:~-5% means that the pointer is offset in the opposite direction, starting from the rightmost end, offset Shift 5 bits, then extract all values to the left from the pointer.
Let’s look at the value of the time variable:
Then the meaning of each of the following operations is as follows:
%time:~0,2% means that the pointer shifts 0 bits to the right from left to right, and then extracts 2 characters starting from the offset position of the pointer, and the result is the hour field value
%time:~3,2% means that the pointer is offset by 3 digits from left to right, and then extracts 2 characters starting from the offset. The result is the minute field value
%time:~6,2% means that the pointer is offset from left to right Offset 6 bits to the right, and then extract 2 characters starting from the offset. The result is the second field value
> log_$(date "+%b_%d_%Y_%H.%M.%S").log
You can adjust the time format yourself.
Just modify the command above