Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to include the path to a library in the Program Files directory, but I need to do this without spaces. I know that Windows uses a convention that shortens names like Program Files becomes PROGRA~1. How can I find these shortened names for an arbitrary directory?

(Apologies if this has already been asked but I couldn't find it.)

share|improve this question
    
Can't you just use quotation marks so you can leave the spaces in place? e.g., "C:\Program Files" –  Uninspired Dec 2 '10 at 0:56

3 Answers 3

up vote 11 down vote accepted

You can use for each folder:

DIR /X
share|improve this answer
    
Thanks! That worked! –  Shane Aug 23 '10 at 13:47
1  
also don't forget dir /x /a for hidden files –  Drew LeSueur Aug 5 '11 at 9:06

in cmd, go to required directory and type dir/x to see the shortened name for your required folder

share|improve this answer

There is a better way to reference the Program Files folder : use the %PROGRAMFILES% variable. And there is no spaces in it :).
For instance : %PROGRAMFILES%\MyLib\MyLib.dll

share|improve this answer

protected by Diago Dec 2 '10 at 7:24

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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