I do a lot of bouncing between cygwin and Windows command shell, and I always end up in pain from miscellaneous space and/or parenthesis issues (MS you really killed me with "Program Files (x86)"). What's the best/easiest way to just rename these directories to drop the spaces and/or parens?

  • My choice would be an underscore to replace any non-alphanumeric characters. – o.k.w Mar 5 '10 at 7:40
  • why do you 'cygwin' around in $PROGRAMFILES anyway? – akira Mar 5 '10 at 8:01
  • You can't rename these directories without getting into heaps of trouble. Some variant of heavyd's answer is probably the way to go. – harrymc Mar 5 '10 at 12:26
  • i access %PROGRAM FILES% because that's how i get to my programs. Not sure what the alternative is. – aronchick Mar 5 '10 at 23:52

Symbolic links in cygwin can help fix this:

ln -s /cygdrive/c/Program\ Files\ \(x86\) /ProgramFilesx86

Learn to use Windows "short names". For example, the short name for "Program Files" is PROGRA~1 and "Documents and Settings" is DOCUME~1.

Type "dir /x" to see short names.

  • what an interesting idea... so I could go into my PATH and update these all? – aronchick Mar 5 '10 at 21:57
  • yes, that is what I have done. – dogbane Mar 6 '10 at 12:18

In Windows you could create a softlink to the directory, using a desired short name, which in reality points to the real destination. Windows 7, and I think Vista, has this capability built in. Similar functionality can be added to XP via the Junction software.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.