Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7489419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:14:42+00:00 2026-05-29T15:14:42+00:00

Possible Duplicate: Why am I getting an access denied error for the Documents and

  • 0

Possible Duplicate:
Why am I getting an access denied error for the Documents and Settings folder?

I have a program that will read all .exe files from a user specified folder and its sub-directories. While testing I tried to scan using C:\ as root.

This threw out an “UnauthorizedAccessException was unhandled” {“Access to the path ‘c:\Documents and Settings\’ is denied.”}

The code snippet doing this is as follows:

 string customScanFolder = Console.ReadLine();
    Console.WriteLine("");

    if (Directory.Exists(customScanFolder) == true)
    {
        string[] customScanResults = Directory.GetFiles(customScanFolder, "*.EXE", SearchOption.AllDirectories);

I am still very much a C# novice, but all Googling and related topics on here have not helped point me in the right direction.

The system my program is running on is Win7 with UAC disabled. The .exe has ‘Run as Administrator’ enabled.

The program will only ever read from files, not write to them. What do I need to do to either grant access rights or avoid this error another way?

Thanks,

Ben

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:14:42+00:00Added an answer on May 29, 2026 at 3:14 pm

    C:\Documents and Settings is not a folder in Windows 7. It’s a Junction (or link) to C:\Users. You should be ignoring it.

    C:\>dir /a:s C:
     Volume in drive C has no label.
     Volume Serial Number is 86F5-8CF5
    
     Directory of C:\
    
    03/04/2011  10:19 AM    <DIR>          $Recycle.Bin
    02/03/2012  03:00 PM    <DIR>          Config.Msi
    07/14/2009  12:08 AM    <JUNCTION>     Documents and Settings [C:\Users]
    12/30/2011  01:19 PM    12,882,337,792 pagefile.sys
    10/23/2009  03:07 PM    <DIR>          Recovery
    01/11/2011  10:24 AM    <DIR>          System Volume Information
                   1 File(s) 12,882,337,792 bytes
                   5 Dir(s)  64,772,997,120 bytes free
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Getting value of a PasswordBox that's inside a ListView I have a
Possible Duplicate: Getting python.exe path at run time I have a python app that
Possible Duplicate: Permission Denied IE iFrame I have an iframe in b.com which attempts
Possible Duplicate: What Advantages of Extension Methods have you found? All right, first of
Possible Duplicate: Can I set a breakpoint on 'memory access' in GDB? I have
Possible Duplicate: Getting DIV content with Regular Expression Let me first tell you that
Possible Duplicate: Getting the Specified content into the buffer in c I have a
Possible Duplicate: pthread Function from a Class I am getting an error (Can not
Possible Duplicate: Getting the ID of the element that fired an event using jQuery
Possible Duplicate: # in url getting ignored in php 5.2 I have following link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.