Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 17 down vote accepted

You can use for each folder:

share|improve this answer
Thanks! That worked! – Shane Aug 23 '10 at 13:47
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

You must log in to answer this question.

protected by BinaryMisfit Dec 2 '10 at 7:24

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

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

Not the answer you're looking for? Browse other questions tagged .