The taskbar clock...can i change it with a batch file?

Where I work we test engines and the data is captured with a calibration tool called Vision. Everytime a file is taken it has the time that it was created. With a little investigation I was able to determine that the calibration tool is using the time that is reported via the clock on the taskbar (I don’t know where that time is generated…I don’t think it is off the system clock).

I have a coworker that is a real jerk. If I have a bunch of data where there is a gap in time that he determines is unacceptable he makes a big deal out of it, and gives me and others the 3rd degree. 99% of the time it is due to something beyond my control and I am tired of dealing with him checking up on me. I want to fix his clock so to speak :smiley:

So what I am wondering is: would it be possible for someone out there to make me a batch file where everytime I run it it would set the taskbar clock to whatever is designated by the batch file (and by extension my data will share the modified time)? I want to be able to have a ton of data shown in windows explorer where each file’s “created-field” is set 5 minutes apart. I could do this I guess manually, but depending on the test I am running it would be alot easier to just run the batch file, and then take my data point.

It sounds like you really just need to set the files’ Create Date. Check out the last third of this page:

Just typing “time 11:15:22.23” works at a command line, so it’s probably batch-able, too.

I would steer clear of changing the taskbar clock every time you run the tool.

The problem is that is the system clock, and all of the files that the operating system manipulates behind the scenes get timestamps based on the system clock.
When you start messing with it, you get some strange stuff appearing in Windows.

Not sure if it would ever cause a crash, but why mess around with a core part of the OS? Use one of those file timestamp editing utilities.

THanks for the replies all…

I forgot to mention that where I work the IT people do not allow us to install 3rd party programs on our work computers, and that is why I wanted to use a batch file (with the hope that I could get around this restriction).

Use the “touch” command for this in your batch file.

Apparently, this is provided in the Windows Resource Kit.


To set the date to 7:30 am 1st October 2015

TOUCH /t 2015 10 01 07 30 00 MyFile.txt

I prefer the touch command provided with the GNU utilities for win32

Sounds like you don’t have Administrator privileges, in which case you won’t be able to make system-wide changes such as adjusting the clock. Just try changing the time one second, which should be harmless, using jormundgondir’s suggestion - in my shell it responds “a required privilege is not held by the client.”

You shouldn’t have any issues with “touch” since it is a single executable that you can place in the same directory as your batch file. It doesn’t need to be formally installed.

People have given good answers to your technical OP question, so I’ll comment on your basic plan.

If he’s a real jerk, why do you want to lower yourself to his level by doing this. (In fact, even lower than him – it could be said that you are falsifying data from your tests, which could get you in real trouble at work.)

If he’s just a co-worker, and not your boss, why do you care about his reactions. Tell him to mind his own business, and decline to answer his ‘3rd degree’ questioning. Just ignore him. Some childhood sayings work well here:
“You do your job and I’ll do mine. And checking up on me is NOT part of your job”. Or “You’re not the boss of me”.

You (and the others) should probably have a talk with your real boss about this. You could just state that he is causing problems & dissension in the work group with this behavior, or point out that he is wasting people’s time and reducing productivity by his actions. (On this board, we call that ‘junior modding’ and people get reprimanded for it.)

That ManiacMan is what QA has to have done if they want to use sampling instead of measuring every part. It’s also something a production manager would need done in a timely manner to minimize the amount of waste produced. I know you can’t always do stuff by the schedule, but changing data is a good way to cause problems. The time of the data collection is often important. It could be important enough to get your ass fired.

Ignoring the ethical considerations of falsifying your data, there’s also the consideration that with most systems, you can run into the OS correcting the clock on you. Most Windows, Mac and Linux machines are configured to use a time service that checks the local time of day clock against an authoritative time server on the Internet. You may find that the clock resets itself in the middle of running a batch of files.

Using the touch command as highlighted by a few people above is a “better” (at least in the technical sense) choice. If you have any programming skill, it’s easy enough to do with a bit of code, too.

The system clock in Windows (and most OSs) is an admin-only thing. So unless you have admin rights then you wont be able to change it via the time command or any other method. In Windows you’ll need to be either an Administrator or a Power User to change the clock.

Seconding everything about it being bad practice to change the clock.

Not to mention, in an active directory domain, a clock that is off may lead your computer to lose authorization with the domain controllers.