DIR /4 doesn't work?

  • Thread starter Thread starter ajs2004
  • Start date Start date
A

ajs2004

According to HELP DIR,

/4 Displays four-digit year

But as far as I can see, this isn't true. Regardless of the /4 option,
I get a date style dictated by Control Panel / Regional and Language
Options 'Short date' format.

Is there a way around this? I want my script to get a four-digit year
for its purpose, whatever preferences users may have set for theirs.

Andrew
________________________________________________

D:\>dir /4 blah.txt
Volume in drive D is User
Volume Serial Number is 5E15-1E91

Directory of D:\

18/10/05 12:00 63 blah.txt
1 File(s) 63 bytes
0 Dir(s) 2,569,834,496 bytes free

D:\>
 
I always force the format YYYY-MM-DD by coding this (independent of user
setting)

thedate = Date()
thedate = Year(thedate) & "-" & Right("0"&Month(thedate),2) & "-" &
Right("0"&Day(thedate),2)
 
At command prompt Type: "dir /4
Do not add filenames. This will change date format for all files and
directories.
Another option is to use Contol Panel / Regional and Language
Options 'Short date' format. Select "Customize" and then "Date" tab. Select Short Date format.
Good Luck.
 
Back
Top