Environment.GetFolderPath(…CommonApplicationData) is still returning “C:\Documents and Settings\” on Vista

后端 未结 5 446
北海茫月
北海茫月 2021-01-29 20:37

As I understand it, you\'re supposed to use the Environment.GetFolderPath method so you have OS independent code...

Windows XP uses C:\\Documents and

5条回答
  •  长情又很酷
    2021-01-29 20:50

    Output on Windows 7 (64-bit)

    SpecialFolder.CommonApplicationData: C:\ProgramData 
    SpecialFolder.CommonDesktopDirectory: C:\Users\Public\Desktop
    SpecialFolder.CommonStartMenu: C:\ProgramData\Microsoft\Windows\Start Menu
    SpecialFolder.CommonPrograms: C:\ProgramData\Microsoft\Windows\Start Menu\Programs
    SpecialFolder.CommonProgramFiles: C:\Program Files\Common Files
    SpecialFolder.CommonProgramFilesX86: C:\Program Files (x86)\Common Files
    SpecialFolder.CommonStartup: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
    SpecialFolder.ProgramFiles: C:\Program Files
    SpecialFolder.ProgramFilesX86: C:\Program Files (x86)
    SpecialFolder.System: C:\Windows\system32
    SpecialFolder.SystemX86: C:\Windows\SysWOW64
    

    Output on Windows XP

    SpecialFolder.CommonApplicationData: C:\Documents and Settings\All Users\Application Data
    SpecialFolder.CommonDesktopDirectory: C:\Documents and Settings\All Users\Desktop
    SpecialFolder.CommonPrograms: C:\Documents and Settings\All Users\Start Menu\Programs
    SpecialFolder.CommonProgramFiles: C:\Program Files\Common Files
    SpecialFolder.CommonProgramFilesX86:
    SpecialFolder.CommonStartMenu: C:\Documents and Settings\All Users\Start Menu
    SpecialFolder.CommonStartup: C:\Documents and Settings\All Users\Start Menu\Programs\Startup
    SpecialFolder.ProgramFiles: C:\Program Files
    SpecialFolder.ProgramFilesX86:
    SpecialFolder.System: C:\WINDOWS\system32
    SpecialFolder.SystemX86: C:\WINDOWS\system32
    

提交回复
热议问题