What If You Delete the "Program Files" Folder in Windows?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

There is a discussion on Hacker News, but feel free to comment here as well.

👍︎︎ 1 👤︎︎ u/qznc_bot2 📅︎︎ Dec 13 2022 🗫︎ replies
Captions
Well, it's time for another computer  experiment, where I try to do things   you should absolutely not do to your own  computer. I'm ThioJoe, and in the past I've   done stuff like deleting the System32 folder,  or deleting the Windows and AppData folder,   stuff like that. But what about those  Program Files folders you've probably seen? There's actually more to it than just programs  you've installed, there's actually some important   Windows files in there. So we're gonna  find out what happens if you delete them,   while Windows is running, of course. That's  the fun part. And actually the result for   this one was pretty hilarious. I was not  expecting it, so I think you'll like this. As always, I am doing this in  a virtual machine. So again,   do not ever do this on your own computer. As  you'll see, it basically will ruin it. Alright,   so quickly for some context, first let's take a  look at what's actually in these folders. Now,   I'm running Windows 11 Pro, and of course  I've enabled Hidden Files and Folders,   as well as System Files and  Folders, so we can see everything. So the three folders we're dealing with  today are the "Program Files" folder,   the "Program Files (x86)" folder,  which has 32-bit files in there,   and then the "ProgramData" folder, which is  related. I'll explain that in a second. So   first looking in the Program Files folder,  this is for a clean installation of Windows. If you have other stuff installed, obviously it's  gonna mess with those too. But as you can see,   it's mostly just some pre-installed  Windows software here. Shouldn't be   too critical for most of these,  like Windows Mail, Media Player,   Photo Viewer. I don't think this is  gonna destroy Windows deleting those. But there are some other folders that  seem like they might cause some issues,   like Windows Defender, Windows PowerShell,  the Common Files folder, which has stuff   like Microsoft Shared and System. These seem  kind of important. Also WindowsApps, I can't   even look into this one normally, so I had to  actually set myself as the owner for these files,   and it looks like there's some install packages or  manifests for those pre-installed files in here. Everything from Bing News to  Sticky Notes, Windows Terminal,   and Notepad. One thing to note though is  I don't believe these are installed here,   it's just some manifests and info about  the installation. Now if we go to the other   Program Files x86 folder, you can see it's  a lot of the same stuff as the other one. We see Windows Mail again, Photo Viewer.  I guess these programs have both 64 and   32-bit stuff in there, so it's in  both folders. There also seems to   be folders in here that look like they  might be important, like Common Files,   as well as the Microsoft folder. Though this one  just seems to have Edge browser stuff, we'll see. And finally we can take a look at the ProgramData  folder, which isn't where programs are installed,   but it just contains data that all users will be  using in relation to a program. So it's not the   installation, it's maybe where settings  files and stuff will go that will apply   to all users. Now several of these are empty,  like the SSH folder, the SoftwareDistribution. There's this "regid1991..." Folder which  just has one file. But there are some other   interesting ones that I'm not 100% sure about.  USOShared and USOPrivate, seems to stand for   "Updated Session Orchestrator", though these  are mostly empty. And then the Packages folder   again. And then going back though, we have the  Microsoft folder, which seems to contain some   important-looking folders that weren't in  the other ones, such as the Windows folder, I would think that's important, it has  stuff even like about the Start Menu.   So I think if we delete this, it might  mess some stuff up with the Start Menu,   we'll see. And then AppRepository,  this seems to be yet more packages.   So let's actually get to the fun part.  So first I tried deleting Program Files. I tried just deleting it all at once. Of course,  that's not going to be that easy. Right away,   the TrustedInstaller permissions  blocked it, which is basically the   highest permission level on Windows. So I  figured let's go inside, see what we can   delete in there individually. And it did let  me delete some when I selected all of them. I did try to delete the others individually, but  again, it wouldn't let me do that. To get access,   I even tried setting myself as the owner for all  these files by changing the security permissions,   but nope, that didn't work.  So this is turning out to be   tougher than I expected. But finally,  I tried a tool called Advanced Run. This is a Nirsoft program, which can let me run  as elevated users. So I ran the Command Prompt   as TrustedInstaller, which we saw before, and  then tried doing the command to delete "Common   Files" just as a test. And boom, finally, it  just went away. So then I tried the command   just on the entire Programs Files folder, and it  went through and it said some were access denied. But if we look inside, there's only a  couple folders left, so it was mostly   successful. We have the Windows Defender  left. Not surprised, there's probably some   extra protections for that folder, as well as  WindowsApps. We'll deal with that later. Now,   before deleting more stuff, let's click around  Windows and see if anything is messed up yet. So the Start Menu seems to look  normal, Edge still opens up. The   Microsoft Store does not open when I  click it in the taskbar. All right,   that's one thing to note. And trying to run  stuff like the calculator from the Start Menu,   also not working, interestingly. So now let's  take a crack at the Program Files x86 folder. Again, I'll just select it all and try and  delete it the old fashioned way. And again,   it deletes a few, but not most of them.  So this time, again, I tried the "Take   Ownership" thing on all folders, and it  does make me do a UAC prompt for every   single one. But when I tried deleting Common  Files in here, it actually worked this time. So I was able to just delete that.  And then it seems like most of the   other ones are working when I delete  it. Though the Microsoft folder won't,   we can save that for later. So we're basically  just left with the Microsoft folder and the   Windows Defender folder. In the Microsoft folder,  it's mostly Edge stuff, and it said it was in use. So I looked in the Task Manager, tried ending the  process in there, although it still wouldn't work.   It still was in use, so I'll save that for  later. And then I'm also going to leave the   Defender folder again. I think that probably  has extra permissions built in. So again,   we can just kind of mess around with  Windows, see if anything has changed. And more stuff seems to be not working  in the Start Menu, like Notepad, Clock,   Movies & TV. Although these might not have  worked before, I didn't actually check these.   Even Terminal won't start. So while the  programs seem to be all broken, it seems   like Windows itself is still fine and dandy. So  maybe deleting ProgramData will mess that up. And actually in ProgramData,  it let me delete a lot more   than the others. There's only three  folders left. Microsoft, Packages,   and USOShared. In Packages, I was able to  delete most inside. There's only a few left,   probably because these are in use. So I ended  the Teams app, and then I could delete that one. I ended Terminal, but still can't. It says  it needs a System permission. And then   in the Microsoft folder, by selecting all folders,  I could delete a decent amount more, there's only   11 folders left now. Though it seems like most  left here either need permission from System or   are also in use. Going back to the Program Files  x86, I wanted to see again about the Edge folder. So I noticed it says in the Task Manager  that the web processes are used by the   widgets. So I ended that process, and  now I could delete those Edge folders,   and so that's the last of the Microsoft folder.  Then going back into Program Files, I was able to   delete more of the WindowsApps folders, and seems  like just Terminal is not letting me do it still. So after deleting all of that, now let's  see if anything is broken in Windows.   So the Start Menu actually opened  up for a second and looked empty,   but then it immediately crashed. And  now it won't open, and nothing happens   when I click it. And then I realized  actually the entire desktop is frozen. Clicking on nothing works, though not the entirety  of Windows is frozen. I was still able to bring   up the Task Manager with the shortcut for  that. So I tried restarting explorer.exe,   and that actually worked. I can now  even open up the Start Menu again,   although the taskbar seems  to be missing some icons. But I want to see if we can break it even more.  So I'm going to try running the command prompt   as the System user using Advanced Run again.  This still seems like it can't delete a lot,   but a lot of it is because it's in use.  So it seems like we will with a little bit   of effort. So to deal with the files that are  in use, I decided to use the PowerToys tools. That is a suite of tools published by Microsoft,   and specifically one of them is called File  Locksmith, which will show you what files   are being used by what programs, and then  lets you end those tasks. And interestingly,   it still had no problem installing software,  although I realized that just went into the   Program Files folder that we're trying to  delete, but we can leave that alone for now. So we can go back to the Search folder for  example, and File Locksmith is telling me   that the Search Indexer is using that.  So I end the task, and now it actually   does let me delete it. But then I realized  it's going to just keep creating it again,   so I'll come back to that. I'll try some  more that are in use, like the AppRepository. It says it's in use by the "AppX" Service,  so I go into the list of services, stop that,   and now I can delete that. There's some more in  use by the "State Repository Service", so again,   stop that and delete it. I tried to finish off the  Packages folder, but it said they were in use and   wouldn't tell me by what, and then I realized  it was just creating those other files again. So I decided to get kind of clever and  change the permissions of these folders,   so that I as the user was able to access it  and delete it, but the system did not have   permission to write to it, so it can't  recreate anything. So now it indeed was   not recreating anything, although now the  indexer is messed up and Explorer is frozen. I guess because it can't index the files or  read what's in here. I don't know, something's   messed up. And then the whole desktop just keeps  crashing, can't really do much here, it basically   seems stuck. So obviously nothing is working  here, so I decided to do a forced reboot,   and when it powers back on, there is no  background to the login screen or anything. It still lets me log in though, it just  took a little bit. But now once I get in,   the Taskbar looks kind of weird. It's the old  Windows 10 Taskbar. There's nothing in the system   tray. I try clicking on the Start Button, it just  says "Critical Error." There's not even an option   to cancel, it just wants me to sign out, but let's  just move that dialog box out of the way for now. I try to open up Windows Explorer, maybe it's  working now, and I noticed something weird.   This is not the Explorer I was using before,  this is the Windows 10 Explorer! So for some   reason it seems like Windows reverted to the  Windows 10 Taskbar and the Windows 10 Explorer,   because basically Windows 11 is built upon  Windows 10, has that still in the background,   so I guess it kind of reverts  to it if something goes wrong. Going back into those folders, it does  look like it recreated a good amount of   them again. But since the Search Indexer was  the thing that probably broke it last time,   let's test and do a search. It seems to be doing  it, but no results are coming up, so it's probably   still not working. So then I bring up the Task  Manager, and it's the Windows 10 Task Manager too! We've literally broken Windows so bad that  it downgraded itself to a previous version.   So then I figured alright, well let's try  one more time to keep deleting stuff. But   as soon as I right clicked, it just started  spinning the cursor, and nothing happened.   Explorer froze and stopped responding.  Right click still works on the desktop,   and I tried another Explorer window, maybe  it was a fluke, but nope, same thing. So because I can't even right click properly,   I think we can officially declare this Windows  installation as ruined. But then I was thinking,   I wonder if there's a way to actually recover  this and fix Windows, so let's see if we can   do that. First I tried the trusty System  File Checker command, so the "sfc /scannow",   and it did say it found some files that  were corrupted, and said it fixed them. And when I went to look at the log  file... but when I tried to hit edit,   it wouldn't open in Notepad, because it  thought that it was not installed anymore,   because the package manifest was gone.  Although I knew Notepad is still in System32,   so I went in there and opened it through  that. So looking through the log file,   it seems like there's a bunch of lines  talking about repairing files in all the   folders we messed with, like ProgramData, Program  Files, you can see it's repairing all of these. So I decided alright, let's restart, see what  happened. But still no background for the login,   the Taskbar still is messed up, still can't right  click in ProgramData, still messed up. So then I   try a command called DISM, this often goes hand  in hand with the System File Checker. Basically,   it makes sure that the files that System  File Checker are using are correct. So I ran that, but that seems to get  frozen at just 60% or so. So I closed that,   ran System File Checker again, but this time it  said there was a bunch of files that couldn't   be repaired. Then I went back and forth  trying the DISM and sfc again a couple times,   and I restarted one last time, but it  doesn't seem to have any improvement. It's still all messed up, I can't even right click  on other folders that we didn't touch in here,   like the Windows directory. So it's not just  the ones we messed with. So the final idea I   figured I'd try is since I messed with the  permissions, and that seems to really have   been the last straw, there is a command to  reset the permissions of folders in Windows. And that is the "ICACLS", and I ran it for  all three of the folders. And it actually   said that it succeeded on some of them,  and failed on the others. Though maybe the   failed ones were ones that were already  fine. So yet again, I restart Windows,   and oh wow, there is actually a  background to the login screen now, maybe we're on the right track.  The taskbar still isn't fixed,   but I can actually now right click on stuff  in the Explorer again. But it still looks   like the apps are missing too. So then  I run sfc again, and this time it says   no integrity violations found, that's kind  of odd. I run DISM again, then sfc again. Both of them think it's all good. However,  it still obviously is messed up. For example,   when I run the Start Menu, it still says critical  error, that sort of thing. So I am officially out   of ideas on how to fix this, I'm going to declare  it ruined. So basically, even though Windows   was able to keep running through all this,  it was not really usable by the end of it. But I still find it really funny that it  started just looking like Windows 10 again,   I didn't expect that. Definitely the point  that really messed with it was when I was   changing the permissions, which didn't allow  it to recreate the files that I was deleting.   And I think that really tripped it up. But it's  really weird that even after running the System   File Checker and DISM, which I thought would  fix permissions anyway, I thought it did that. And then I explicitly ran the fix permissions  command. Even though it improved it,   it still didn't fix it completely. So  yeah, obviously don't do this. You'd   probably have to do a clean install to fix it  for sure. So anyway, if you enjoyed this video,   definitely give it a big thumbs up. And let  me know down in the comments what you thought, and if you have any ideas for stuff I should try  in a future video. If you want to keep watching,   I'll put a couple of previous "What If"  videos here, like where I deleted System32,   as well as the AppData folders. Those are  pretty fun as well. So you can just click   on those right there. So thanks so much for  watching, and I'll see you in the next one.
Info
Channel: ThioJoe
Views: 226,813
Rating: undefined out of 5
Keywords:
Id: BVIN_PJu2rs
Channel Id: undefined
Length: 14min 18sec (858 seconds)
Published: Wed Dec 07 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.