-1

I have a program installed under c:\Program Files. The entire directory tree is marked Read Only, including c:\Program Files. There's one configuration file that I need to change for this program, I need to add a line for the default start parameters, but I don't seem to be able to make any changes, even if I run Explorer as Administrator, it won't change the read-only status of the file or its directory.

How can I actually change the file I need?

Update: the entire directory tree of this program under Program Files is marked as being owned by Administrators, is that normal? What it affect changing the configuration file?

2 Answers 2

3

You can edit the file outside that area by copying it to your desktop, editing it, and then copy it back manually. This will give a UAC elevation warning but as long as you have admins rights you should just click OK and it will copy.

The reason for this is to prevent random programs from corrupting or modifying protected operating system files.

You might be able to launch your editor as an administrator, right click and select "run as administrator", then browse to the file you want to edit but copying it away and then back may be safer.

5
  • Launching the editor as admin doesn't do it; you still get blocked - I've tried this. Copy-out, edit, copy-in seems to be the only way to do it. Dec 7, 2020 at 16:37
  • I've tried running Explorer.exe as admin and got no results, the file permissions are not changed. Why is that?
    – markspace
    Dec 7, 2020 at 17:04
  • Because file permissions don't matter, it is an operating system protected area. You need to copy out and back in, and OK the UAC prompt. If you have disabled UAC then re-enable it.
    – Mokubai
    Dec 7, 2020 at 17:36
  • Thanks, your answers were helpful. I ended up using the method I posted below, but I tested your method and it did indeed work. It's an option of someone finds this works best for them.
    – markspace
    Dec 7, 2020 at 18:33
  • I did mention running the editor as administrator in my answer.
    – Mokubai
    Dec 7, 2020 at 18:41
1

I'm going to add this because I got this advice and it also worked:

You have to run Wordpad (or whatever editor you're using) as an administrator. And don't forget to save a copy first! Best regards, Peter

Running the my editor (in my case, Gvim) with Administrator permissions worked and allowed me to edit the file in-place without making a copy. I had to navigate to the file itself to do this, then pick "Run as Administrator." Trying to use the quick bar at the bottom of my screen or use the Start menu did not work. Those are links, not the "real file" and Windows won't present a "Run as Administrator" option. You have to open Explorer and locate the binary file under "C:\Program Files" to do this.

After I ran the editor as Administrator, I was able to load the file, edit it and save it back normally. Painful but it worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .