A variável de ambiente %DIRCMD%
pode ser usada para especificar padrões para dir
.
Por padrão, o comando% ' dir
do Windows classifica arquivos e diretórios em ordem alfabética sem agrupar. O resultado é que os arquivos e diretórios aparecem intercalados entre si. Exemplo de saída:
F:\Dev Kits>dir
Volume in drive F is Buffer II
Volume Serial Number is E039-C389
Directory of F:\Dev Kits
07/26/2011 05:02 AM <DIR> .
07/26/2011 05:02 AM <DIR> ..
10/08/2009 05:41 PM 408,330 Bat To Exe Converter 1.5.zip
07/26/2011 04:53 AM <DIR> Boost
10/27/2009 09:37 PM 20,248,963 CodeBlocks 8.02 Mingw.exe
02/20/2010 12:26 AM 1,251,993 CodeBlocks Manual.pdf
04/18/2010 05:39 PM 610,769 Dependency Walker 2.2.6000 x86.zip
05/29/2010 04:37 PM 4,387 Dev Kits.sha2
07/26/2011 04:59 AM <JUNCTION> iOS SDK
01/31/2011 09:40 PM 35,213,765 MinGW GCC 4.4.0_1.zip
11/17/2009 01:41 AM 2,834,808 Notepad++ Portable 5.5.1.exe
01/07/2010 06:04 PM 3,860,528 Notepad++ Portable 5.6.4.exe
11/17/2009 12:31 AM 261,563 Notepad2 4.0.23.zip
03/08/2011 07:07 PM 9,932,872 Opera Mobile 10.1 Emulator.exe
05/25/2010 08:46 AM 162,506 PC-Police.zip
04/05/2010 10:37 PM <DIR> Python
07/26/2011 05:02 AM <DIR> Qt Framework and SDK
04/05/2010 10:35 PM <DIR> Series 80 SDK
07/26/2011 04:52 AM <DIR> Symbian SDK
07/26/2011 05:00 AM <DIR> Unit Testing
07/26/2011 04:51 AM <JUNCTION> Visual Studio Tools
04/07/2011 04:51 PM 17,349,072 Win32 OpenSSL 1.0.0d.exe
02/19/2010 11:05 PM 397,056 Win32pp Compiled Samples.zip
07/26/2011 04:53 AM <DIR> Windows Phone SDK
07/26/2011 04:52 AM <DIR> Windows Platform SDK
11/14/2009 07:49 PM 12,811,696 wxMSW 2.8.10 Setup.exe
11/15/2009 01:34 AM 2,808 wxMSW Installation.txt
15 File(s) 105,351,116 bytes
12 Dir(s) 1,346,224,128 bytes free
A adição da opção /OGN
torna a saída muito mais organizada:
F:\Dev Kits>dir /ogn
Volume in drive F is Buffer II
Volume Serial Number is E039-C389
Directory of F:\Dev Kits
07/26/2011 05:02 AM <DIR> .
07/26/2011 05:02 AM <DIR> ..
07/26/2011 04:53 AM <DIR> Boost
07/26/2011 04:59 AM <JUNCTION> iOS SDK
04/05/2010 10:37 PM <DIR> Python
07/26/2011 05:02 AM <DIR> Qt Framework and SDK
04/05/2010 10:35 PM <DIR> Series 80 SDK
07/26/2011 04:52 AM <DIR> Symbian SDK
07/26/2011 05:00 AM <DIR> Unit Testing
07/26/2011 04:51 AM <JUNCTION> Visual Studio Tools
07/26/2011 04:53 AM <DIR> Windows Phone SDK
07/26/2011 04:52 AM <DIR> Windows Platform SDK
10/08/2009 05:41 PM 408,330 Bat To Exe Converter 1.5.zip
10/27/2009 09:37 PM 20,248,963 CodeBlocks 8.02 Mingw.exe
02/20/2010 12:26 AM 1,251,993 CodeBlocks Manual.pdf
04/18/2010 05:39 PM 610,769 Dependency Walker 2.2.6000 x86.zip
05/29/2010 04:37 PM 4,387 Dev Kits.sha2
01/31/2011 09:40 PM 35,213,765 MinGW GCC 4.4.0_1.zip
11/17/2009 01:41 AM 2,834,808 Notepad++ Portable 5.5.1.exe
01/07/2010 06:04 PM 3,860,528 Notepad++ Portable 5.6.4.exe
11/17/2009 12:31 AM 261,563 Notepad2 4.0.23.zip
03/08/2011 07:07 PM 9,932,872 Opera Mobile 10.1 Emulator.exe
05/25/2010 08:46 AM 162,506 PC-Police.zip
04/07/2011 04:51 PM 17,349,072 Win32 OpenSSL 1.0.0d.exe
02/19/2010 11:05 PM 397,056 Win32pp Compiled Samples.zip
11/14/2009 07:49 PM 12,811,696 wxMSW 2.8.10 Setup.exe
11/15/2009 01:34 AM 2,808 wxMSW Installation.txt
15 File(s) 105,351,116 bytes
12 Dir(s) 1,346,224,128 bytes free
Pergunta : é possível fazer dir
usar a opção /ogn
por padrão?
Tente abrir o Painel de controle > Sistema > Guia Avançado > Variáveis de ambiente.
Crie a variável de sistema DIRCMD
e atribua o valor /a /c /p /x /o:gen