Share via

dir command ignoring 4-digit date switch

Anonymous
2013-06-10T19:43:33+00:00

In the command shell (cmd.exe), the following 3 commands give me identical results (2-digit year)

dir

dir /4

dir /-4

I recently got a new computer, but my old computer was also running Win 7 and the dir command gave me 4-digit year by default.

How can I force dir to to give me my 4-digit year back.  (I have some text parsing scripts that rely on 4 digits.)

Windows for home | Previous Windows versions | Windows update

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-06-11T10:30:15+00:00

Hi Hoss,

What is the format of the date settings on the right bottom of the screen?

It looks like the date is not set correctly on the computer. . Verify that your date format is set correctly.

a. Go to Start, Control Panel, “Clock, Language and Region”, then “Region and Language”.

b. Click the Formats tab, and then, in the Format list, select the locale to use for the display of the date.

You may change the format to MM/dd/yyyy in short date tab.

Also refer:

Change the display of dates, times, currency, and measurements

http://windows.microsoft.com/en-US/windows7/Change-the-display-of-dates-times-currency-and-measurements

Once you have changed the format, you may check with the issue.

Hope this information helps. Reply with the status so that we could help you further.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-06-11T17:09:27+00:00

    Changing my short date format as you described fixed the problem.  I also tried some of the other formats to see if the DIR command always used that setting, and it looks like it does.

    So in summary, the /4 switch on the DIR command does nothing--the date format is determined by the Short Date format setting in the Windows Control Panel.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-06-12T09:46:07+00:00

    Hi,

    Glad to hear that the issue is resolved!

    Your efforts to resolve this issue is very much appreciated.

    Feel free to post your query here on Microsoft Community Forums, we will be more than happy to assist you.

    Was this answer helpful?

    0 comments No comments