0

When working with batch I used the variables %date% and %time% to get the date and the time.

Somewhere between the lines I wanted to change %date% and %time% because I wanted to use a different format, I wasn't aware of other ways to do so, so in my script I had the lines:

@set date=/*something*/
@set time=/*something*/

Here's a script which shows my problem: The first time it shows the date and time and then it shows /*something*/

@echo %date%
@echo %time%

@set date=/*something*/
@set time=/*something*/

How can I set it back to the date and time?

I really hope you can help me.

1 Answer 1

2
set "date="
set "time="

date and time are magic variables - set by the system but setting them to any value overrides the system-supplied value.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.