Windows temp directory details (Java)

后端 未结 7 2234
一生所求
一生所求 2020-12-20 15:12

I\'m writing a program that needs a generic temp folder. I\'m trying to find details about the Windows Temp folders. There are two paths that I know about -

7条回答
  •  失恋的感觉
    2020-12-20 15:31

    To answer part of your question - if you're using .NET, you can use the Path.GetTempPath() method of the System.IO namespace to get the location of the temporary directory.

    // Get the path of the temporary directory
    string tempDir = Path.GetTempPath();
    
    // "Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file."
    string tempFile = Path.GetTempFileName();
    

提交回复
热议问题