Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deleting Locked Fies Manually - Windows CMD.
#1
Using Cacls in Windows CMD to modify ACLs.

Or, in simpler terms, taking control of files/folders.

This is very similar, to the thread I posted about taking control of files/folders, using Windows Explorer.

The method here though, is quite different as it uses the CMD program within Windows XP
and I just thought that it would have been a bit too much, and maybe a little confusing, to have included it, in the other thread.

It's not always possible to delete certain files, if they are locked in some way, and being used by another process or user.

There are ways of getting around this, but it doesn't work for 100% of files, but it will let you delete or modify many.

There is the program called:

cacls.

Which allows you to take ownership of files, normally restricted by the System.

This only works for the NTFS file system OS though.

This means that there could be a possiblity that it may also work, for Windows Vista and Windows 7.

Open the CMD program and type - [Not case sensitive]:

cacls /?

and hit return, to display the cacls help menu.

To save a text file of the help menu, at the command prompt, type:

cacls /? > FileName.txt

and hit return, to save a text file of the help menu, to:

C:\Documents and settings\YourName\My documents\

as an example, but it will save the file to the default folder for your documents, unless you specify a folder path at the command prompt.
It also has to be an existiing folder, as it doesn't seem to work, if you try to create a new folder.

[NOTE: When you open the saved text file, if you add so much as even one space to it, and then save it, the next time that you open the file, the formatting and spacing will have been completely removed.
This is also the same, if you copy and paste the text to another text file].


This means that if you want to keep a log of what files you change, unless you leave them as they are, you will have to respace them by hand. It shouldn't take that long though, a few minutes perhaps,
as there probably won't be that many entries in the list.

[NOTE: It may be a good idea, if you are going to try this,
to make a copy of an unimportant text file, or something similar, to try it out with, the first time that you do this]
.

At the command prompt, type:

cacls FileName.ext

and hit return to display the ACL - [Access Control Lists].

Example: It may show a group of entries in the list, ranging from Administrator to System.

C:\Documents and settings\YourName\My documents\FileName.ext YourPCName\Administrator:F
NT Authority\System:R
BuitIn\Users:R
BuiltIn\Administrators:F


Where:

F Full Control
R Read
W Write
C Change [Write]
N None


At the command prompt, type:

cacls FileName.ext /g Administrator:f

and hit return.

Once again at the command prompt type:

cacls FileName.ext

and hit return again, to display that only Adminstrator, is left in the ACLs.

C:\Documents and settings\YourName\My documents\FileName.ext YourPCName\Administrator:F

You can verify this, by using Windows Explorer.
Right click on the file and select Properties and then click on the tab for Security to confirm this.

If you want to add a user or group that has been removed from the ACLs, type the following, with the relative
UserTongueerm parameters at the command prompt:

For example:

cacls FileName.ext /e /g system:r

to add the user System to the ACLs, with read only access rights.

So if you type, once again at the command prompt:

cacls FileName.ext

and once again hit return, you will see that the ACLs will look like:

C:\Documents and settings\YourName\My documents\FileName.ext YourPCName\Administrator:F
NT Authority\System:R


To get it back to just yourself in the ACLs, at the command prompt type:

cacls FileName.exe /g Administrator:f

And once again, type:

cacls FileName.ext

to verify that you are the only entry left in the list.

For those files which cannot be deleted after making modifications, you can use Unlocker to do it instead.

http://ccollomb.free.fr/unlocker/

Once again, I hope that some of you, may have found this to be useful.
[Image: SF1d.gif]

Real knowledge is to know the extent of one's ignorance - Confucius
------------------------------------------------------------------
Reply
#2
This problem is well known and finally I found solution for it:
http://pathtoodeep.com
Reply
#3
Lmao im going to use this in my virus.. Thanks OP!
slowly getting better
Reply
#4
mausingh Wrote:This problem is well known and finally I found solution for it:
http://pathtoodeep.com

I dont think you've read this properly. It's a tutorial, not an issue he's trying to solve.

Old Dirty Bastard Wrote:Lmao im going to use this in my virus.. Thanks OP!

This is not HF, discussion about viruses are not supposed to be on Support Forums.


Unlocker is a good program though. I use this as well. I used to hate having to look through all the processes and find out which process was using a file that I wanted to be deleted. Or rebooting my computer.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  FileTerminator Batch/CMD Script AceInfinity 1 1,004 08-31-2011, 11:11 PM
Last Post: Prominent
  FileSort v1.00 CMD Script AceInfinity 7 2,077 08-30-2011, 10:38 PM
Last Post: Prominent
  [Video Tutorial] How to add Cmd Prompt to Context Menu (Right-Click) AceInfinity 37 16,685 04-19-2011, 06:32 AM
Last Post: Spectrum
  How To Run CMD (Command Prompt) From *Anywhere* Resistance 8 7,244 03-20-2011, 02:11 PM
Last Post: AceInfinity
  Deleting Locked Files Manually - Windows Explorer. UID=0 12 8,822 10-10-2009, 04:02 AM
Last Post: UID=0

Forum Jump:


Users browsing this thread: 1 Guest(s)