大网数据广告活动
Windows排障命令

flattemp

· 52CE 我爱测

Reference article for the flattemp command, which enables or disables flat temporary folders.

Enables or disables flat temporary folders. You must have administrative credentials to run this command.

Note: This command is only available if you have installed the Remote Desktop Session Host role service.

Syntax

flattemp {/query | /enable | /disable}

Parameters

Parameter Description
/query Queries the current setting.
/enable Enables flat temporary folders. Users will share the temporary folder unless the temporary folder resides in the user's home folder.
/disable Disables flat temporary folders. Each user's temporary folder will reside in a separate folder (determined by the user's Session ID).
/? Displays help at the command prompt.
Remarks
  • After each user has a unique temporary folder, use flattemp /enable to enable flat temporary folders.

  • The default method for creating temporary folders for multiple users (usually pointed to by the TEMP and TMP environment variables) is to create subfolders in the \Temp folder, by using the logonID as the subfolder name. For example, if the TEMP environment variable points to C:\Temp, the temporary folder assigned to the user logonID 4 is C:\Temp\4.

    Using flattemp, you can point directly to the \Temp folder and prevent subfolders from forming. This is useful when you want the user temporary folders to be contained in home folders, whether on an Remote Desktop Session Host server local drive or on a shared network drive. You should use the flattemp /enable* command only when each user has a separate temporary folder.

  • You might encounter app errors if the user's temporary folder is on a network drive. This occurs when the shared network drive becomes momentarily inaccessible on the network. Because the temporary files of the app are either inaccessible or out of synchronization, it responds as if the disk has stopped. Moving the temporary folder to a network drive is not recommended. The default is to keep temporary folders on the local hard disk. If you experience unexpected behavior or disk-corruption errors with certain applications, stabilize your network or move the temporary folders back to the local hard disk.

  • If you disable using separate temporary folders per-session, flattemp settings are ignored. This option is set in the Remote Desktop Services Configuration tool.

Examples

To display the current setting for flat temporary folders, type:

flattemp /query

To enable flat temporary folders, type:

flattemp /enable

To disable flat temporary folders, type:

flattemp /disable

Related links

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 10/16/2017
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。