- cross-posted to:
- [email protected]
Actually on windows 7 I found out how to get which process is locking one file.
You open the resources manager (task manager has a link to it)
Inside you can see how much each process uses on cpu, network and stuff.
And there is a tab where all used files for each process is listed. You can search for specific files.
“Hey can I rent this apartment?”
“Let me check… Seems like it’s already occupied”
“Omg who is occupying it?”
“Let me print out their name and contact details for you”
back in the XP days, I used a software called “Unlocker” just for this problem. It probably still exists, I don’t know, because since Windows 7, the easiest way to find out what process locks a file is to open Resource Monitor (Start search: resmon) and on the CPU tab, using the “Associated handles” list, you can search for the file name and see the process in question (and kill it).
So yeah, Resource Monitor is a useful tool on Windows.
There’s a collection of free little utilities called Microsoft PowerToys, including the file unlocker thing. Why would they not include these into base kit Windows is beyond me.
not including PowerToys inside basic package is a fucking choice. Win11 is literally unusable without it in many aspects.
I would argue windows 11 is pretty much unusable regardless
LTSC is probably usable but if the base is so broken - i wonder if LTSC is still as good as Win10 LTSC.
I feel like it’s a testing ground for new features for them, but not sure why some aren’t yet integrated. Best guess: the PowerToys team has less red tape and checks to go through than the Windows team to allow for faster iteration, but that means that integrating the features wouldn’t be just the click of a button since they’d have to adapt it to fit the Windows style. But this is just a wild guess.
Why would they not include these into base kit Windows is beyond me.
Some of them felt a bit buggy when I last time used Windows, maybe they aren’t fully ready to ship (like Samsung’s Good Lock apps?). And most features didn’t do quite what I imagined it to do, but that’s probably a “me problem”.
That’s a fair point, but, let’s be honest, the built in Windows features often have the same issues
Not recently copilot and AI implementation has made the OS beyond shitty recently and a lot of broken shit. That’s why I need to move to Linux they’re basically sinking their ship with broken AI code.
The telemetry is overbearing too lately.
Bill Gates secret hotline.
probably.
Because they want to include things with ads now.
“Hey Linux, can you just delete this file please?”
“Sure thing bud, a program is using it, it’s ok, I will just unlink the inode anyway, the program can still access it until it closes the file”
This is honestly one of my favorite features of the linux filesystem. As a dev it makes things like replacing and hot-reloading plugins way easier.
It turns out you can kind of get the same functionality on Windows if you rename the open file and place the new one with the original name, but it’s a bit of a hack.
Windows won’t let you rename a file that’s being used either.
Yeah, super annoying. In Linux you can rename or move it and the app using it doesn’t care.
Although having the option of listing the app using a file so I can kill the app would also be really nice to have. I’m sure Linux has something for that too, but I don’t know what it is.
You can use PowerToys on windows to see what app is using a particular file
I’m sure Linux has something for that too, but I don’t know what it is
fuser
I can’t remember the other program that’ll do it.
But there’s another one that’ll list all the processes using a file.
Tip of my tongue fuck.
That’s actually a thing, but I’m not entirely sure in which cases. Probably only for services and not apps, but I’ve done that myself where deleting a file was impossible, but renaming it and deleting it worked.
Maybe it’s only possible in certain cases, but I can tell you for certain it’s possible with running exe’s and loaded dll’s. I have a CMake step on Windows that does this rename hack so my builds don’t fail if I still have the app running.
Same thing whenever I try to unplug a USB, Win10, on my desktop. There have been times where I plugged in one, opened a file, closed it within seconds, did the safely remove thing, and then I get the whole quick song and dance about some program still using it because of how sluggish it is to actually end what’s using it in the background.
Also, my phone’s keyboard software was bugging out and replaced “song” with “incest” for no discernable and wanted to replace the next word “and” with “rape incest”. Not related, but fuck Gboard and that weird glitch where it’ll replace words with random shit for no reason.
Doesn’t gboard try to promote words you’ve used more prior more often than ones you’ve used less…?
OK, WTAF on those word replacements. I’d be freaking out about malware.
That’s what happens when they train it on bad porn sites.
I cannot remember what it’s done in the past, but I’ve definitely had much more tame occurrences of this. Same with holding the delete key and having the thing think that the first letter of a word doesn’t exist from time to time.
Probably a couple of minor bugs that g••gle doesn’t care to fix.
There are good keyboard apps on F-Droid…
Reason 3756 why Windows is slopware
Me: I’ve close the program, now please delete the file
Windows: ok, give me half an hour, it’s not easy to delete 500 MB
Hey Linux, sudo rm -rf /
sigh I’m surrounded by idiots.
“Sure thing boss” you fucking moron.
Here’s an incredibly animated chart of how poorly I’m doing. Note that I seem to throttle the operation every 5 seconds or so.
Explanation? No, no. Haha. No. We don’t do anything like that.
… And the file is back open somehow. Only now the program throws an error when Windows launches, yet still leeches resources.
deleted by creator
Mac does the same thing (as others have said) and you can at least
sudo lsof
and find it, but somehow filesystem access now is worse than Windows 95 era Excel spreadsheet file handles that never worked.Here’s what an operating system is peeps: Something that handles files and programs that live on top of it. That’s it.
How is it none of them can’t do their basic function anymore?
Files, hardware / peripherals and programs. The distinction can get a bit blurry what with drivers and the fact that Linux exposes most of the hardware via the filesystem.
Same command works on Linux. Its a real saver sometimes.
You can also specify a path.
Some Windows apps do handle it properly. For example, if you have an archive open in 7-zip and try to delete it, Windows Explorer should correctly tell you that it’s open in 7-Zip. I’m not sure why it doesn’t work that way for all apps.
Windows doesn’t even tell you if Explorer itself has a folder open… how the hell does 7-Zip do it?
Different user
In case anyone is interested, there’s a powertoy called file locksmith that will show what’s using it and let you kill it: https://learn.microsoft.com/en-us/windows/powertoys/file-locksmith
You can use the built-in tool resmon.exe to do the same
Powertoys seems to be the only thing keeping windows somewhat usable, I have no idea why they don’t include it in the build.
I discovered powertoys only recently, and it’s a pretty cool set of tools. From color picker, tiling window manager to regex file renames or copy/paste tools, it has a lot of QoL features.
If you have to be on windows, i.e due ro work, I recommend not sleeping on it.
Why isn’t this in their OS instead of unwanted AI
The performance view thing that comes with windows also allows searching for file handles but it’s not very user friendly. Also not possible without admin rights if I remember correctly
“Time to see who’s stopping me from deleting this file… svchost??? Goddamn it!”
Well, it could be an executable disguising itself as svchost. Pretty common for malware or video game cheats to name their executables svchost.exe to hide from anti-virus/anticheat
Probably the indexing service, it’s always the indexing service.
just kill it
I used to, all the time
This was in the XP days so I didn’t know how to figure out which service it was, I was a kid. But some svchost process would manifest as a task to switch to in the alt + tab switcher and made the computer slow and weird. I just killed it. No idea if it was a bug or a virus.
Instructions unclear, I shot my gaming rig with a 6 bore shotgun…. And then set it on fire.
Instructions may have been unclear, but you got the gist of it.
Hole-y and on fire:
“This program is preventing Windows from shutting down:”
He’s a little confused, but he’s got the spirit.
What gets me is when I’m not allowed to remove an external drive. Deleting a file can be delayed until later but here I am with a physical object that I need to detach from my computer and first I need to play hide and seek with the OS.
You can use this performance view thing that comes with windows to search for file handles and the processes that own them
If this happens often, you can disable write caching for that drive. It’ll feel slightly slower (since it’s actually operating at the speed of the hardware instead of caching operations in RAM and gradually writing them to disk in the background), but you’ll be able to remove the drive almost instantly.
Shouldn’t that happen automatically if the drive is identified as removable? And the real solution should be to tell the OS that it’s removable?
I used to find it had something to do with the explorer thumbnailer finishing up but sort of not letting go. It would happen if I had pictures or videos on the USB drive, and if I got the error I could go to another folder like my documents, drag a picture into another folder, go look at the pretty new thumbnail, then I could remove the USB drive because the thumbnailer was ‘parked’ back on the C drive. Sounds like I’m making it up but I swear it worked.
And that removable object’s filesystem is probably the most shit, unjournalled filesystem in the world so you’re actually fucked if it becomes corrupted by removing it early.
And if you move the drive between operating systems you’re very limited in what filesystems you can use because Windows is very limited in what filesystems it can use. So you can’t just pick a more robust filesystem.
Yeah that was kind of my point.
TBF the task manager and those windows explorer dialogues were programed in like 1996 and it’s probably one of the best functioning feature in Windows so changing it too much carries high risks.
changing it too much carries high risks
This is such a Windows way of thinking and I can’t really explain it. Why does every other OS constantly change and evolve but Windows is like “can’t touch this code from a quarter century ago?”
I dare say, that 90% of all companies in Europe and US, use Windows. And lots of companies relies heavily on software built 20-30 years ago. Microsoft knows this.
That’s why they are very reluctant to “touch that piece of code from a quarter century ago” because there’s probably a lot of software that would break without it. Software their target audience need.
Because any time anything changes in Windows, people bitch about it.
I don’t see the problem with it. Microsoft historically does a great job of making everything worse with updates.
Becuase it’s still integral to countless businesses operations.
Lol yea, but it would have been such a small tweak with big big QoL improvements LMAO
There is nothing in windows that’s a small tweak.
Changing anything has implications to a banking business Joe somewhere, who’s program depends on the original feature working as it does, or one of the 16 layers of code is simply tangled in a way such change would require cascade of rewrites.I’ve read articles about various developments: working with
regexregistry*, or just adding a control panel option, and it’s an absolute nightmare.Bring back spacebar heating!
You can use process explorer, it even has option to act as a replacement for task manager.
Edit: https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer
The current UI is very different to the original UI though.
Yeah I think they changed how it looks starting in Windows 8.
Same on Mac except it’s an external drive that some mystery program is using.
same with my kobo. It VERY rarely ejects it. It will just say “unable to eject. force eject?”
It’s your finder, you’re viewing the drive atm
opening the task manager with a shotgun cocking sound
Shame…
Windows response:
Shame…“Windows.exe has stopped working”
Oddly enough, this specific problem is usually solved by restarting Explorer, which is basically “windows.exe.” No explorer, no windows.
Linux fuser for the win
Or stay with the basics and use lsof.
Either way, not coming with that tool by default and forcing every usage of the file to lock it is a really stupid pair of mistakes.
I’ve never fused Linux before, is it difficult?
fuser is an easy command just point it at the file and it tells you the process ids that using that file.
Not anymore. Many distribution will have most of what you need out of the box depending on what your needs are. They mostly feel like windows XP or 7.
where do i get linux xp 7?
Either a distribution with KdE Plasma (Kubuntu for example), or something like Zorin OS works really well.
Arch wiki