Access is Denied - on Program Files folder

May 1, 2020 at 07:39:29
Specs: Windows 10
Hi,

I reinstalled Windows 10 on my machine
This machine has the Program Files software on my D: drive, being:
D:\Program Files
and
D:\Program Files (x86)

I re-installed Windows, but I left the D: drive not formatted.
Now, after all is done, I would like to re-use the same directory, but it states "Access is denied."

I am using elevated Administration mode, and I did change the attributes to remove any Read-Only attributes.

So, when I run :
rmdir /S /Q "D:\Program Files"
it replies with Access Denied, on every file and directory it finds in there.

How do I get this directory gone ? ( And NOT use formatting)


See More: Access is Denied - on Program Files folder

Reply ↓  Report •

#1
May 1, 2020 at 09:12:46
A little konphusing...

Are you saying that during the re-installation of win-10 - presumably to the C: drive, you left the D: drive untouched, and thus its contents (programme files) from previous installation are still there?

And that you'd like to either delete the contents of D: (from the previous win-10 installation) and use it for whatever (and obviously without reformatting D: )?

Or are you hoping to access the contents and use the programmes already there with the re-installed win -10 (which as best I know you can''t - as the new registry won't know about them...)?

I think you're dealing with a question of ownership of those files; but as I don't use windows these days, I'm a little rusty on some aspects. But with the above konphusions clarified others here will no doubt confirm (or refute..) my suggestions - re ownership, and not not able to use those programme files anyway?


Reply ↓  Report •

#2
May 1, 2020 at 09:23:05
Yes, it is ownership but, without looking, I'm not sure who the owner should be. If it's a single-user machine then that user would probably do.

But, as trvlr says, you won't be able to use the programs as registry entries will also be needed. The only safe option is to format the disk and reinstall the programs.


Reply ↓  Report •

#3
May 1, 2020 at 09:46:33
> Are you saying that during the re-installation of win-10
> - presumably to the C: drive, you left the D: drive
> untouched, and thus its contents (programme files) from
> previous installation are still there?
>
> And that you'd like to either delete the contents of D:
> (from the previous win-10 installation) and use it for
> whatever (and obviously without reformatting D: )?
>
> Or are you hoping to access the contents and use the
> programmes already there with the re-installed win -10
> (which as best I know you can''t - as the new registry
> won't know about them...)?
>
> I think you're dealing with a question of ownership of
> those files; but as I don't use windows these days,
> I'm a little rusty on some aspects. But with the above
> konphusions clarified others here will no doubt
> confirm (or refute..) my suggestions - re ownership,
> and not not able to use those programme files anyway?

Windows keeps those directories there for backup purposes.

I am aware you cannot use any software in the new installation.

As stated, the purpose is just to have a backup. That is
the Windows intended purpose of those directories.

I do not want to "delete the content of the D drive", I
want to remove those directories.

If I would like to remove anything, I agree in using:
format D:

It is an ownership problem probably, but I can already confirm
the "name" of my account is the same, but the technical account
is obviously different, since this is a new installation.


Reply ↓  Report •

Related Solutions

#4
May 1, 2020 at 09:49:51
> Yes, it is ownership but, without looking, I'm not sure
> who the owner should be. If it's a single-user machine
> then that user would probably do.

Guess it doesn't as I am using a user with the same name,
and I still got this issue. There's not many users
involved here, so what user could it then be ?

> But, as trvlr says, you won't be able to use the
> programs as registry entries will also be needed. The
> only safe option is to format the disk and reinstall
> the programs.

This thread is not about that, I am using the RMDIR command,
what do you think I am installing ?

Also, you don't need to format a data disk "to use it safely".

message edited by Tangoscar4


Reply ↓  Report •

#5
May 1, 2020 at 10:01:11
Usernames mean very little in Windows; what is important is the UID, which is a long, fairly random number generated when the user is created. You have to take ownership of the folders.

https://www.howtogeek.com/301768/ho...


Reply ↓  Report •

#6
May 1, 2020 at 14:18:38
I've dun a wee trawl (out of academic interest here as I run Macs these days, but it's useful to know a few things about current windoze...) and found these - anyone of which may be of help?

https://tinyurl.com/ybu4d5ma

https://tinyurl.com/y9h8wmua

https://tinyurl.com/yxtqdedq

https://tinyurl.com/ycjlw6eo

https://tinyurl.com/ybdblh6h

I'd be inclined to think one of the first four be useful...; possibly the third or fourth especially?

I found them via duckduckgo trawl around the duck pond using the string:

take ownership of files and folders on another drive windows-10

and there are lots more along the lines of the above.

There was a time when windows was "relatively..." straightforward in such matters of ownership; but it seems that's no-longer the case (M$-land yet again phyxing wot ain't broke).

At which point I shall retire to sidelines again and have another noggin of sherry.

message edited by trvlr


Reply ↓  Report •

#7
May 1, 2020 at 15:31:03
Tangoscar4 wrote:

> I do not want to "delete the content of the D drive", I
> want to remove those directories.

That is very confusing. Deleting the content of the D drive
and removing the directories which are on the D drive are
essentially synonymous.

Could you try saying that one more time?

If you want to remove the directories on the D drive, what is
wrong with formatting it?

I'm going to read the links trvlr posted before trying
to guess what the immediate problem might be.

-- Jeff, in Minneapolis

message edited by Jeff Root


Reply ↓  Report •

#8
May 4, 2020 at 13:34:50
> That is very confusing. Deleting the content of the D drive
> and removing the directories which are on the D drive are
> essentially synonymous.

Incorrect. In fact, that statement is hilarious ...

> I'm going to read the links trvlr posted before trying
> to guess what the immediate problem might be.

The actual command that fails is stated in the opening post. Why don't you read it ?

message edited by Tangoscar44


Reply ↓  Report •

#9
May 4, 2020 at 13:42:36
> Usernames mean very little in Windows; what is important
> is the UID, which is a long, fairly random number generated
> when the user is created. You have to take ownership of the
> folders.

That's what I said. If you know I re-installed Windows, what other option do I have than to use a user with the same name ? Using one with a different name won't help.
I could of course setup an Active Directory server, so that I can use domain users, and then I can remove 1 directory. Yes, that sounds fair.

I mean, re-installing Windows is a basic task. The only difference is that I'm using a drive different than C: for my Program Files. And, it is more common for people to format the C: drive again, before re-installing Windows, but you can also NOT do that (as I did). But all that also doesn't matter if my Program Files was not on C: anyway. Yes, I can format that drive (any drive). But I don't need to, I know what is on my drives. Also, the format in the installer is useless as it is basic, so if you want to do it correctly, you'll need to redo it anyway.

> https://www.howtogeek.com/301768/ho...

I'll have a look there, opening Pandora's Box again. You know, this issue is nothing new, it existed in Windows 7 as well.


Reply ↓  Report •

#10
May 4, 2020 at 13:57:34
The other option you have is to take ownership of the folders. It's the only option you have.

Reply ↓  Report •

#11
May 4, 2020 at 14:45:16
My memory from the days long ago, when I used windoze, was that even if one used the same user name for the re-install one still had to take ownership of folders/files created by the previous installation. Much as if one was taking ownership of content formerly another’s.

That being an Admin privilege and option.


Reply ↓  Report •

#12
May 4, 2020 at 22:34:32
That's correct. You can't duplicate a UID, so you can't duplicate a user.

Reply ↓  Report •

#13
May 5, 2020 at 03:02:03
Tangoscar44 replied:

>> I'm going to read the links trvlr posted before trying
>> to guess what the immediate problem might be.
>
> The actual command that fails is stated in the opening
> post. Why don't you read it ?

I agree with trvlr and ijack that the problem is
probably just that you don't have ownership. If all you want
to do is delete the files and folders with the rmdir commad,
then taking ownership is the only prerequisite.

> If you know I re-installed Windows, what other option do I
> have than to use a user with the same name ? Using one
> with a different name won't help.

Using the same name won't help, and using a different name
won't hurt. Windows won't know whether you use the same
name or a different one.

-- Jeff, in Minneapolis


Reply ↓  Report •

#14
May 11, 2020 at 11:56:03

> Using the same name won't help, and using a different name
> won't hurt. Windows won't know whether you use the same
> name or a different one.

It actually does.

When you do NOT format your C drive, Windows keeps a copy of Windows itself, on that same drive. It also backs up other stuff, like Program Files and whatnot.

So, it copies some odd 30 Gigs of data, and you think Windows doesn't know what the previious user was ?

The thing is, they don't want to know, since if they know, they have to do something with that, and they didn't bother to go that far.

And even if you format your C drive when installing, do you think MS would be able to store an 8 to 16 character string ? But that is not the issue here. If they aren't going to do something with it, it doesnt matter.


Reply ↓  Report •

#15
May 11, 2020 at 12:05:48
#5 is the solution, but you must make sure of a coupld of things: when you take ownership, there's 2 different checkbox that each relate to child or sub-directories. It's not until I used both, that I managed to achieve the goal. You can't remove any directory for as long as there is 1 file or directory still left inside.

These files and directories have the same ownership issues, so you must mass fix it starting from the root.

It actually is a present issue on any system, but you normally don't remove C:\Program Files just for fun. And that's where the issues start: you can have Program Files on D, E, or whataver drive. And if you re-install Windows, MS may not properly remove old software.

Sometimes it's just attributes as well, like I think was the issue with the C:\Windows.old I found on my C drive.

But you can just use the default Windows ownership function, to fix that.
Also note I had to have it owned to an Admin account, not to a regular one.


Reply ↓  Report •

#16
May 11, 2020 at 12:09:58
> The other option you have is to take ownership of the folders. It's the only option you have.

That's a contradiction, no ? :)

The lazy option = format the damn drive
The intelligent option = try to get the Folders fixed

And there's a third option, which is to ignore the presence, but that is bad


Reply ↓  Report •

#17
May 11, 2020 at 13:21:40
Thinking back to my days with the dreaded windows - from NT/‘9x and upto XP... - I recall that ownership is an Admin only option when it come to taking ownership; and there were considerations re’ file and folders.

An upgrade of windoze from one version to another usually included a roll back arrangement too; meaning that the previous version was backed up should it be required for a roll back to it? A clean install didn’t create or allow that roll back; and a repair installation essentially the same as a clean install - no roll back provisions created/updated...

If apps. etc. were installed to a different partition to the system files, they would often/usually be left where they were during a clean installation; but unusable for the most part. A repair “usually” left some of them useable, most of the time...


Reply ↓  Report •

#18
May 11, 2020 at 21:17:28
Tangoscar44 replied:

> > Using the same name won't help, and using a different name
>> won't hurt. Windows won't know whether you use the same
>> name or a different one.
>
> It actually does.

Windows does not know whether you use the same name or a
different one, even if that name is stored in 10,000 places in the
old installation.

> When you do NOT format your C drive, Windows keeps a copy
> of Windows itself, on that same drive.

Depending on what you are doing, Windows may "keep a copy"
of the old operating system (meaning simply that it does not write
over the old operating system-- it does nothing) or may overwrite
the old operating system if you tell it to.

> It also backs up other stuff, like Program Files and whatnot.

If but only if you tell it to do so.

> So, it copies some odd 30 Gigs of data, and you think Windows
> doesn't know what the previious user was ?

Windows doesn't know that you are the previous user just because
you type in the same name. You will be given a new user ID that is
different from the old user ID, and that is how the user is identified.

Some programs ("portable programs") can be run in Windows
without installing them. If such a program has been copied to your
hard drive, it can be run from there, even if it was part of the old
Windows installation. Other programs need to be installed from
scratch in order to use them in your new Windows installation.
All of the data saved by those programs should be intact, as long
as you didn't encrypt it and haven't deleted it. Encrypting it would
only be a problem in certain specific situations.

> You can't remove any directory for as long as there is 1 file or
> directory still left inside.

Not with the 'rd' command, as you were trying to do. It can be
done with the 'deltree' command.

I expected that that was part of your problem.

> And if you re-install Windows, MS may not properly remove
> old software.

It does what you tell it to do. If you tell it to delete or format a
partition, it will do so. If you don't tell it to, it won't. The old
software will not interfere with the new as long as you don't do
something silly like leave installed programs in the old Program
Files folder and then try to install the same program in the new
Windows installation in that old folder.

It sounds like you wanted to delete all of the old files from your
old folders, but leave the old folder structure in place for the new
Windows installation to use. Much, much faster to delete the
partitions and let Windows reformat the drive and use the new
folder structure which it is going to create in any case.

-- Jeff, in Minneapolis



Reply ↓  Report •

#19
May 11, 2020 at 22:36:26
There is a difference between doing a Windows upgrade and installing a fresh copy. The former preserves the old users, via their UIDs, the latter doesn't.

Anyway, your problem is now solved.

You're welcome.


Reply ↓  Report •

Ask Question