GetEnvironmentVariable ("TEMP") without tilde (~)

I want to get the temp ( C:\Users\user\AppData\Local\Temp

) folder path .

GetEnvironmentVariable("TEMP")

works fine, but I get the tilde path:

C:\Users\STANHE~1\AppData\Local\Temp\

      

.. and I need a path without tilde:

C:\Users\StanHerrmann\AppData\Local\Temp\

      

+3


source to share


1 answer


You can use Path.GetFullPath

to expand it:

If you pass in a short filename, it will be expanded to a long filename.



But ... it would be better to just use Path.GetTempPath

for this, t have to rely on environment variables to be correct.

+4


source







All Articles