views:

40

answers:

1

I have a process that injects environment variables while the process is running and all that works fine. However, when I expand one of the environment variables (Environment.ExpandEnvironmentVariables in C#) sometimes I get a compressed value of the file path:

d:\progra~1\mifbef~1...

instead of

d:\Program Files\...

Functionally it is a valid path and I can cd to it. But I want it to be uncompressed value. Any ideas where to start troubleshooting this?

+1  A: 

The Path.GetFullPath method will expand compressed paths.

string uncompressedPath = Path.GetFullPath(Environment.ExpandEnvironmentVariables("%TEMP%"));
Ani
thanks, that worked!
kateroh