Saturday, February 18, 2012

Find DOS-style short names in Windows: dir /x

Having recently begun working on Windows 7 I was disappointed to find that MSFT still has spaces in important directories (Program Files, for instance): this is often a cause of syntax issues, usually when running *sh scripts from Cygwin.


In most cases quoting the path name works, but not always.  I've found that the short style DOS directory name works in most cases where quotes fail.


C:\>dir /x
03/17/2011  08:42 PM                25              AUTOEXEC.BAT
05/05/2011  09:33 PM    <DIR>                       bea
07/19/2010  10:37 AM               211 BOOT_G~1.INI boot_GDISK32_copy.ini
08/26/2008  06:45 AM                 0              CONFIG.SYS
12/21/2011  10:39 PM    <DIR>          DOCUME~1     Documents and Settings
07/19/2010  10:19 AM    <DIR>                       DRIVERS
03/17/2011  08:42 PM                91 GPROLO~1.BAT gprologvars.bat
07/19/2010  10:44 AM    <DIR>                       Intel
02/04/2012  08:45 AM    <DIR>          PROGRA~1     Program Files
11/10/2011  08:40 AM    <DIR>          QUARAN~1     Quarantine
10/24/2010  09:23 PM    <DIR>                       TEMP
02/16/2012  07:58 PM    <DIR>                       WINDOWS

No comments:

Post a Comment