What is the Programdata/Application Data folder?

2019-08-03 22:18发布

问题:

So I am writing an application that iterates through a specified directory tree and I was experimenting with the exception that handles permissions for folder access and there was one folder I came across that the compiler returned that had the directory of C:\ProgramData\Application Data

Does anyone know what this folder is? It doesn't seem to exist within Windows Explorer. Like, the folder isn't there. It's not hidden. It just isn't there. I was able to get inside the folder using an elevated command prompt but when I used the "dir" command to see what the folder contained, CMD returned:

"Directory of C:\ProgramData\Application Data

File Not Found"

I am curious to know what this folder is.....

回答1:

The dir /a command is your friend here:

C:\ProgramData>dir /a
 Volume in drive C has no label.
 Volume Serial Number is 848A-BBB7

 Directory of C:\ProgramData

23/05/2015  03:38 pm    <DIR>          .
23/05/2015  03:38 pm    <DIR>          ..
14/05/2015  10:28 pm    <JUNCTION>     Application Data [C:\ProgramData]

As you can see, Application Data is a junction point which points back to ProgramData. Windows includes a number of similar junction points, for backwards compatibility with older applications.

The security permissions on the junction point explicitly prohibit listing files, which is why you can't get a listing of its contents:

C:\ProgramData>icacls "Application Data" /L
Application Data Everyone:(DENY)(S,RD)
                 Everyone:(RX)
                 NT AUTHORITY\SYSTEM:(F)
                 BUILTIN\Administrators:(F)

Also, the junction point is marked System and Hidden:

C:\ProgramData>attrib /L "Application Data"
   SH   I    C:\ProgramData\Application Data

which is why Explorer doesn't show it. (It appears that Explorer does not show junction points marked hidden and system, even if configured to show hidden items.)