-1

Ok, so I found how to get a date as a variable in a batch file scanning StackOverflow and it seems to work on other machines but not the one I generally work on.

Echo Time seems to work OK: C:\Users\matthewh\areaDeploy>echo %TIME% 8:47:47.03

Echo Date gives me this: C:\Users\matthewh\areaDeploy>echo %DATE% _ 8______ __ 8_

I have another PC that gives me: 22/08/2023 A coworker gets: Tue 08/22/2023

I don't know why I have three different formatting methods, or why mine's totally out of whack. In the end I'm trying to add the variable to a file being archived so it will be NameYYYYMMDD

tarnis
  • 1
  • 3
  • 1
    Does this answer your question? [How do I get current date/time on the Windows command line in a suitable format for usage in a file/folder name?](https://stackoverflow.com/questions/203090/how-do-i-get-current-date-time-on-the-windows-command-line-in-a-suitable-format) Specifically, parse the output of `wmic os get localdatetime` so that you get the same format everywhere. – SomethingDark Aug 22 '23 at 14:12
  • 2
    `%date%` is highly customizable and depends on locale settings and user settings . Yours indeed looks messed up. Do `set date` - you should get something like "not defined". If not, you created a user variable with the same name (by accident). You can delete it with `set "date="` – Stephan Aug 22 '23 at 14:26

0 Answers0