views:

613

answers:

5

Hey all,

I have a strange (don't ask) need to see a few examples of a msdos (winxp cmd shell) DIR command for lots (some) of different localized versions of windows (eg. french, spanish, etc).

The specific command I need is (note that this command is important... if you don't bother to use this command then don't bother to respond):

dir /4 /-c /t:a /n /a:-d-h-s

I know it's a crazy hope but I'm hoping to be able to chop/parse the output regardless of localization.

Thanks!

A: 

Here's the output for Korean XP:

 C µå¶óÀ̺êÀÇ º¼·ý¿¡´Â À̸§ÀÌ ¾ø½À´Ï´Ù.
 º¼·ý ÀÏ·Ã ¹øÈ£: 7C33-7DCE

 C:\WINDOWS\system32 µð·ºÅ͸®

2009-02-02  ¿ÀÈÄ 11:39              1697 $winnt$.inf
2008-02-19  ¿ÀÈÄ 09:07              2151 12520437.cpx
2008-02-19  ¿ÀÈÄ 09:07              2233 12520850.cpx
2008-02-19  ¿ÀÈÄ 09:06            100352 6to4svc.dll
2008-02-19  ¿ÀÈÄ 08:47              1460 a15.tbl

(seem to have lost the unicode during transfer... but for my purposes that's ok).

+1  A: 

Probably not what you want to hear but we found all sorts of problems in relying on behavior in different localizations of Windows.

We had a cmd file which worked fine in US English but when we sent it for localization, they found all sorts of issues, and we have to support about 23 different versions.

In the end, it was easier to write (actual C) code to get the information via Win32 and output it in the format we wanted. This removed reliance on specific localization formats and configuration issues (some commands output differently not just based on locale but also on user configuration).

My advice: find a different way of doing this.

paxdiablo
sounds about right. +1
Learning
See my additional post.
A: 

Sure... it's the wrong way... but needs must/devil drives. The underlying problem is that the machine the command runs on cannot be modified/relied upon. The parsing/chopping is pretty minor (pull out a filename, file size and the creation date). The good news is that the filename is guaranteed to not include any spaces. Which means the last 2 fields of a split() are the filename and size and the first N fields are the date (note I don't need the date as a date, just a string is fine). Trickiness may be involve ensuring unicode moves around correctly (unlike in the Korean example).

A: 

I'm having exactly the same problem with a program that works fine in US but bombs in France, despite careful changes. But not sure the problem is localization. I'm getting stuff like this:

05/01/2007 05:30 3805 BUILTIN\Administrateursagent_completeRefhost.xml 05/01/2007 05:30 1242 BUILTIN\AdministrateurscommonRefhost.xml 05/01/2007 05:30 4429 BUILTIN\Administrateursem_noseedRefhost.xml

The owner field BUILTIN\Administrateurs occupies all the space right until the first letter of the filename. This makes parsing very difficult unless I can be sure that the owner field always occupies X number of characters. In other words, that the filename always begins X characters from the beginning of the owner string. Any ideas if that's the case?

Thanks, Keith Adams, consultant SAS Institute

+1  A: 

Polish windows Vista outputs:

C:\Users\Karol>dir /4 /-c /t:a /n /a:-d-h-s
 Wolumin w stacji C to OS
 Numer seryjny woluminu: 3EC1-6B83

 Katalog: C:\Users\Karol

2009-12-10  21:19              2263 intlname.ols
2009-07-23  21:17              1480 laptop_to_epia.ppk
2009-07-23  21:17               466 laptop_to_epia.pub
2010-01-31  09:49             10392 _viminfo
               4 plik(ów)              14601 bajtów
               0 katalog(ów)     10880864256 bajtów wolnych
lollinus