How can we find windows Temp folder ?
-
Hey guys. How can we find windows Temp folder in c# ? Like this :
C:\Documents and Settings\Mds\Local Settings\Temp
Thanks in advance.
-
Hey guys. How can we find windows Temp folder in c# ? Like this :
C:\Documents and Settings\Mds\Local Settings\Temp
Thanks in advance.
-
Hey guys. How can we find windows Temp folder in c# ? Like this :
C:\Documents and Settings\Mds\Local Settings\Temp
Thanks in advance.
Here you are: Environment.GetEnvironmentVariable Method[^]
Giorgi Dalakishvili #region signature my articles #endregion
-
Hey guys. How can we find windows Temp folder in c# ? Like this :
C:\Documents and Settings\Mds\Local Settings\Temp
Thanks in advance.
The previous answer is correct and is what I use but (for the sake of completeness) there's also
Environment.GetEnvironmentVariable("TEMP");
orEnvironment.GetEnvironmentVariable("TMP");
Didn't see Giorgi's answer till after posting as it was on the next page!Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog) -
The previous answer is correct and is what I use but (for the sake of completeness) there's also
Environment.GetEnvironmentVariable("TEMP");
orEnvironment.GetEnvironmentVariable("TMP");
Didn't see Giorgi's answer till after posting as it was on the next page!Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog)Thanks a lot DaveyM69. But I want to know is this correct :
Environment.GetEnvironmentVariable("temp");
-
Thanks a lot DaveyM69. But I want to know is this correct :
Environment.GetEnvironmentVariable("temp");
It works (tried on XP Pro SP3) so I guess the string parameter isn't case sensitive. They are saved however in upper case so it would be safer to pass it that way. You can see all the variables by opening control panel and selecting System (or right click My Computer and chose properties). On the Advanced tab click the Environment Variables button.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog) -
It works (tried on XP Pro SP3) so I guess the string parameter isn't case sensitive. They are saved however in upper case so it would be safer to pass it that way. You can see all the variables by opening control panel and selecting System (or right click My Computer and chose properties). On the Advanced tab click the Environment Variables button.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog)Thank you very much DaveyM69.