Windows temp directory details (Java)

后端 未结 7 2253
一生所求
一生所求 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:36

    The %TEMP% environment variable that's defined on my PC (XP SP3) uses the DOS-style abcdef~1 directory names - hence, if you can pull that variable, you should end up with a path without spaces.

    e.g. Start>Run>%TEMP% takes me to C:\DOCUME~1\\LOCALS~1\Temp

    However, if a 'super-user' fiddles around with that variable and points it somewhere else, it's possible that things will fall over. You could look at something like this to retrieve the 8-char-and-no-spaces path.

提交回复
热议问题