2
I'm working on two (virtual) machines:
- First is a Windows 10 machine
- Second is a Windows 7 machine
On both, the short date formats are equal: dd.MM.yyyy
On both, I'm running the same batchfile, based on the DATE
command.
I'm having differences in the results, related to the outcome of the DATE
command results:
- On Windows 10 :
The current date is: st 22.03.2017
- On Windows 7 :
The current date is: 22.03.2017
As you can see, the difference is due to the presence of the name of today (st
is an abbreviation of the Czech word for Wednesday
).
The Windows 10 system is the master, so my question: how can I alter the Windows-7 system to include the first two letters of the name of the day?
As tests, I've already tried the following for a short date format:
dd dd.MM.yyyy // this is better, the length of the format is good,
but it does not start with the initials of the day's name.
dddd dd.MM.yyyy // this starts with the day's name, but completely,
and I only want the first two letters.
Meanwhile I had a further look at the problem: the date format seems to be used on two places:
- While working with the
DATE
commandline command (there I need a format likexx dd.MM.yyyy
(whatever thatxx
might be) for further processing - During following
echo
:for /r %DIRECTORY% %I in ("*.*") do echo %~tfI
The idea is to show a timestamp and the filename, something like:
22.03.2016 13:50 <filename>
(withoutxx
)
It's not possible to have 2 character weekdays in Windows 7. – DavidPostill – 2017-03-22T12:39:04.887
I see two choices: (1) use long day format, but change the day names to their short equivalents, though this means that you will never see the true long day names; (2) write your own program to report the date: this would be only a few lines of
C
, and will be completely independent of regional settings, or it could be done in a somewhat complex batch file which manipulates the contents of the `%DATE% variable. – AFH – 2017-03-22T13:02:26.303Use
– DavidPostill – 2017-03-22T13:22:32.820wmic
or PowerShell to manipulate the date in a Locale, Regional, and Language settings independent way. See my answer Batch script (cmd) resulting in DD-MM-YYYY_weekday format for some tips.@AFH: unfortunately even writing an own little program does not solve the issue: I would need to call this program "date.exe", but when I launch
Date
, even in the directory where I've just compiled "date.exe", it still keeps on taking the commandlineDATE
command instead. – Dominique – 2017-03-22T14:42:59.453Why do you need to give it the same name? Why not call it
CzDate.exe
or something similar? Incmd
thedate
command is a shell built-in, so will always be chosen in preference to an externaldate.exe
, unless you add a path to the call, eg.\date
; alternatively, for command-line use (not in a batch file) you can set an alias, egdoskey date=.\date.exe
. – AFH – 2017-03-22T15:39:14.633