收藏到CSDN网摘
Before this COVID-19 thing happened, the desktop sitting on my desk runs for ever. I usally run some expensive jobs over night and came back to check the results in the next morning. Nowaways, the PCs are very different from the old days machines that require a regular restart from time to time. However, while working on a laptop since the lockdown started it's impossible to keep the laptop running all the time. So I have to start all the applications at the beginning of my working days and close them in the afternoon. If your work is to surf the internet and gather data, it's absolutely fine to click one button and job's done. But if your work relates to multiple applications, it is a bit annoying. I need to find a way of doing that automatically. There are some nice software that you can rely on (someone recommends AutoHotKey although I didn't try it). I'd like to do it lightweightly, say using batch file (in command line). Here we go!
26 Jun 2020
16 Jun 2020
Get Current Date and Time in Batch
收藏到CSDN网摘
From time to time, we may need to get the current date and time in batch to automate some tasks. For instance, I am modifying the compiled programme names using the current date, which is easy to archive and search in the future. There are such DOS commands exist such as Date and Time, which you can use to retrieve or set the current date and time respectively. However, we may like to get all this information in one go and manipulate it as required. If you're on Windows like me, the Windows Management Instrumentation (WMI) Command line tool (WMIC.exe) could be used for this purpose. The following batch shows how to get the date and time information and use them as variables in the batch.
From time to time, we may need to get the current date and time in batch to automate some tasks. For instance, I am modifying the compiled programme names using the current date, which is easy to archive and search in the future. There are such DOS commands exist such as Date and Time, which you can use to retrieve or set the current date and time respectively. However, we may like to get all this information in one go and manipulate it as required. If you're on Windows like me, the Windows Management Instrumentation (WMI) Command line tool (WMIC.exe) could be used for this purpose. The following batch shows how to get the date and time information and use them as variables in the batch.
Subscribe to:
Posts
(
Atom
)