Discussion Locked

How to set W2K Time via a Batch file

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a need to set the date and time of W2K Adv Server machine to a specific time and date, do my tests, then reset the system time to the same date and time as before and repeat my tests. This will loop a number of times. I try to write a batch file to do this, but I can't find enough info for W2K to perform this task. Does anyone has any suggestion, or pointer? Thanks in advance.

Regards,

5 replies

by abarnes70

To set the time in a batch file, you simply use the TIME command, using the new 24hr time as a parameter. For example, to set the current time to 11:30PM, use

time 2330

To set the time back to 10:15AM, use

time 1015

The DATE command works in a similar fashion. You can get help for either by typing /? after the time or date commands.

by khongphutu

Thanks, but this does not work for W2K.
I figured it out, based on your suggestion using 24-hr clock but with the colon separator and period format after severval trials: time hh:mm:ss.tt

Example: time 10:15:00.00

The /T option skipped the promnpt, such does not meet my need.

Thanks again.

by gbeck

Adding to answer 1. You need the /t switch to avoid stopping the bat-file for input request; i.e. time [/t] xx:xx

by khongphutu

Thanks, but the /T option skipped the prompt, which does not meet my need. I need to change the time, not to find the time.

Thanks again.

This discussion is closed to new replies.