Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What folder does Path::GetTempFileName Method save to?

I need to get the temp file to see what happened because the actual file is never output. However, I can't seem to find where the temp file is created.

I need to find this out without writing code or building the application because there are too many dependencies scattered all over the place. I would not be able to deploy a debug version.

like image 901
Brian T Hannan Avatar asked Jul 23 '10 16:07

Brian T Hannan


1 Answers

That method returns the path of a temporary file. The path will tell you where its pointing.

For example:

Console.WriteLine(Path.GetTempFileName());

produces:

C:\Users\will\AppData\Local\Temp\tmp9BD5.tmp

for me on this machine, because the TEMP environment variable is pointing to C:\Users\will\AppData\Local\Temp\

But the whole point of a method like GetTempFileName is that you shouldn't have to care where the file ends up. On the off-chance that you do, you can always get there at command prompts or file-open dialogs by using %TEMP%

like image 86
Will Dean Avatar answered Oct 24 '22 21:10

Will Dean