You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows桌面应用文件安装位置及规范技术咨询

Windows Application File Placement Standards (Windows 7+)

Hey there! Since you're building a Linux installer and need to map the equivalent Windows file placement rules (for Windows 7 and newer), let me walk you through the standard, best-practice locations that mirror Linux's FHS but are tailored to Windows' ecosystem.

Core Application Files

These are your read-only binaries, resources, and core program files—think the equivalent of Linux's /usr/bin or /usr/share.

  • 64-bit applications: Install to C:\Program Files\YourAppName\
    • This is the system's default directory for 64-bit software, protected by UAC (users can't write here without admin rights, which prevents accidental tampering).
  • 32-bit applications: Install to C:\Program Files (x86)\YourAppName\
    • Dedicated directory for 32-bit programs on 64-bit Windows; same UAC protections apply.

Configuration Files

Split into global (all users) and user-specific, just like Linux's /etc vs ~/.config.

  • Global configuration (all users): C:\ProgramData\YourAppName\
    • Use this for settings that apply to every user on the machine (e.g., default templates, system-wide app preferences). Note: This directory requires admin rights to modify by default, so set appropriate permissions if your app needs non-admin users to change global settings.
  • User-specific configuration:
    • Roaming (follows user across domain accounts): %APPDATA%\YourAppName\ (resolves to C:\Users\[Username]\AppData\Roaming\YourAppName\)
    • Local (stays on this machine): %LOCALAPPDATA%\YourAppName\ (resolves to C:\Users\[Username]\AppData\Local\YourAppName\)
    • Use roaming for settings users want to carry with them (e.g., UI preferences), local for large or machine-specific configs.

Log Files

Equivalent to Linux's /var/log.

  • Global logs (all user activity): C:\ProgramData\YourAppName\Logs\
    • For system-level logs or activity that applies to all users.
  • User-specific logs: %LOCALAPPDATA%\YourAppName\Logs\ or %APPDATA%\YourAppName\Logs\
    • Use local for logs tied to the machine, roaming if you need logs to follow the user. Avoid storing logs in the program directory—users won't have write access there without admin rights.

Data Files

Split into shared and user-specific, like Linux's /var/lib vs ~/.

  • Shared data (all users): C:\ProgramData\YourAppName\Data\
    • For common assets the app needs (e.g., shared libraries, default datasets, cached resources used by all users).
  • User-visible data: %USERPROFILE%\Documents\YourAppName\
    • Use this for files users will actively look for (e.g., saved projects, exported documents)—it's the Windows equivalent of a user's ~/Documents folder.
  • User-private data: %LOCALAPPDATA%\YourAppName\Data\
    • For data users don't need to access directly (e.g., cached files, local databases).

Temporary Files

Equivalent to Linux's /tmp.

  • Use %TEMP%\YourAppName\
    • This points to the user's personal temporary directory (C:\Users\[Username]\AppData\Local\Temp\YourAppName\). Windows automatically cleans this directory periodically, so only store files your app needs for short-term use.

Key Best Practices

  • Use environment variables instead of hardcoding paths: For example, %ProgramFiles% instead of C:\Program Files—this works across non-system drive installs and localized Windows versions.
  • Respect UAC permissions: Don't write to the Program Files directory at runtime; use the designated config/log/data directories instead to avoid permission errors.
  • Service-specific files: If your app includes a Windows Service, install the service binaries to C:\Program Files\YourAppName\Service\, store service config in C:\ProgramData\YourAppName\ServiceConfig\, and logs in C:\ProgramData\YourAppName\ServiceLogs\.

内容的提问来源于stack exchange,提问作者NicolasR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:56:39