vote up 1 vote down star

FYI: I'm using Windows 7.

In one case, I was just writing a test app to enumerate all files on my system, and I get an "access denied" error for "c:\documents and settings" (which was returned by .net when I said 'give me all subfolders in c:\').

What gives?!

Thanks!

flag
As this is a programming question it belongs on Stack Overflow. You don't need to do anything, it'll get moved if enough (5) people agree. – ChrisF Nov 23 at 21:16
2  
I don't believe this IS a programming question. It might contain programming, but it's about the OS, not the code. – Phoshi Nov 23 at 21:19
@Phoshi - I see where your coming from, well we'll see if anyone else agrees. – ChrisF Nov 23 at 21:31
I agree with Phosi, it wouldn't matter if he were writing a program or not, lets pretend he purchased this program and is running it on his computer and its giving him permission errors when running it – qwertyKid Mar 8 at 4:31

2 Answers

vote up 2 vote down

c:\documents and settings doesn't -really- exist. It points straight to \users (A halfway decent filepath. I mean, \documents and settings? What were they THINKING?), it's not a real path, and is only there for compatibility reasons. You try to save a file at c:\documents and settings\username\hello.txt, it'll work, but it's only in there for compatibility reasons.

Deleting a file from a USB drive - is it one of those ones that can be set to read only? If so, is it?

link|flag
1  
Yeah, I was trying to say that my app actually got "c:\documents and settings" by calling Directory.GetDirectories(), so I'm confused why the API would return a directory that doesn't actually exist. Anyways, I'm also getting such errors when attempting to scan through other folders. – Christopher Nov 23 at 21:06
It's not the only false folder in the filesystem, unfortunately. It exists, but only barely. I'm afraid it's just something you have to deal with. If the API didn't return it, older programs, or programs that rely on it returning it, would fail, wheras programs being written now can be written BETTER because of it ;) – Phoshi Nov 23 at 21:15
have you tried to take OWNERSHIP of the ENTIRE C drive?? if you do this and set it to the user that you are running the program it should not get accesed denied. – mike Nov 24 at 6:10
NO. That might have been acceptable back on XP, but Vista/7 are trying to change the whole we'll always have admin rights! ethos. You won't, and if you can't write your program without needing them you'd better have a damn good reason. – Phoshi Nov 24 at 8:47
1  
@mike - Very bad advice for way more reasons than I can put into a comment. – MarkM Mar 8 at 4:09
vote up 0 vote down

Hello. Whatever it is you are trying to write, I believe, like what Mike pointed out, you should "Take Ownership" of whatever drive / folder that your access has been denied. Even though you're the admin, if Administrator group is not defined in the list of users with access, you still cannot access the file / drive. Just "Take Owbership" of the file, problem solved. You would see in the folder properties that you don't have the access (Administrator group), that's why you were denied access of the folder / file / drive, etc.

Here's the link: http://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/

link|flag

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.