BAT gets the system date, the time, and the space after the time and time of day before the hour is removed

Source: Internet
Author: User
@echo off REM bat gets the system date, time, and the space that precedes the time hour and the time behind the spaces echo  * * * *%date% echo  * * *%time%set thisdate=%date:~0,4%%date:~ 5,2%%date:~8,2% Echo  %thisdate%rem minus hours before the space set h=%time:~0,2% set h=%h: =0% set log_filename=%date:~0,4%%date:~5,2% %date:~8,2%%h%%time:~3,2%%time:~6,2%rem Remove the left side space rem:intercept_left rem if "%h:~0,1%" = = "" Set "h=%h:~1%" &goto Intercept_leftrem Remove the right space: intercept_rightif "%log_filename:~-1%" = "Set" log_filename=%log_filename:~0,-1% "& Goto Intercept_right Echo%log_filename%.logpause

The results are as follows:

2015/08/27 Thursday

10:07:17.50

20150827

20150827100717.log

BAT gets the system date, the time, and the space after the time and time of day before the hour is removed

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.