By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

removing a file

Read-only media, through I can't imagine this being the case on drive C:. Is there an error message?
@rconn - great to see a post from you this AM. Hope all is well with you!

Permissions: I have edited the del_me.btm to issue a ICACLS as quoted here:

ACLs - not sure what that is - except for something in a person's body....

open files - not the case as all the files are a subset in c:\backup\....

system files: the files only have "A" attribute....... not "S"..... or am I missing something?

@Charles Dye - see my comment about file attributes above.....
Is there a way to be told exactly why a file can not be DEL'ed? Maybe a plugin?
This works.

1. Take ownership of the file (I did that manually)
2. use ICACLS to make yourself named among the principals (you're not, even if you own the file) ... AND WITH FULL ACCESS.

I used

c:\program files (x86)\common files\microsoft shared\dao> ICACLS dao360.dll /grant vefatica:F
processed file: dao360.dll
Successfully processed 1 files; Failed processing 0 files

3. Delete it.

I actually deleted the real thing (and restored it from a copy).
c:\program files (x86)\common files\microsoft shared\dao> del dao360.dll
Deleting C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\dao360.dll
     1 file deleted

If you insist on doing this in a script, you'll have to figure out how to change ownership with a script. SUBINACL is pretty easy to find. Google turned up this example

subinacl /file test.txt /setowner=domain\user_id

And Windows 10 has TAKEOWN.EXE.

And ICACLS has a "/setowner" option.
Does ICACLS then need to be run in the fileToWorkOn's folder, not say, C:\
I found another file owned by TrustedInstaller. I backed it up and did this (elevated).

v:\> takeown /f "c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll"

SUCCESS: The file (or folder): "c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll" now owned by user "JJ\vefatica".

v:\> ICACLS "c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll" /grant vefatica:F
processed file: c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll
Successfully processed 1 files; Failed processing 0 files

v:\> del "c:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll"
Deleting C:\Program Files (x86)\Common Files\Microsoft Shared\ink\rtscom.dll
     1 file deleted

Then I restored the file from the backup.
What is the syntax to redirect all output and errors to the bit-bucket please?

>>! nul


Similar threads