I have several files that will not delete - in TCMD / TCC / windows 10 Explorer. Does anyone have a script where you pass it a file name and it says the attributes (R,H,S,A, etc) and who has the rights to access the file and what rights those are?
v:\> echo %@attrib[w32tmparams.btm]
___A_____________
v:\> echo %@owner[w32tmparams.btm]
JJ\vefatica
v:\> icacls w32tmparams.btm
w32tmparams.btm BUILTIN\Administrators:(I)(F)
NT AUTHORITY\SYSTEM:(I)(F)
NT AUTHORITY\Authenticated Users:(I)(M)
BUILTIN\Users:(I)(RX)
Successfully processed 1 files; Failed processing 0 files
[C:\Users\csgal\OneDrive\Desktop\JV16PT\thursday]set fn=%@line[thursday.txt,0]
[C:\Users\csgal\OneDrive\Desktop\JV16PT\thursday]echo %fn
C:\Backup\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~19041.1415.1.6\amd64_microsoft-windows-a..g-whatsnew.appxmain_31bf3856ad364e35_10.0.19041.746_none_57c8601baf818c0d\f\new360videossquare44x44logo.targetsize-16_altform-unplated_contrast-black.png
[C:\Users\csgal\OneDrive\Desktop\JV16PT\thursday]echo %@attrib[%fn]
___A_____________
[C:\Users\csgal\OneDrive\Desktop\JV16PT\thursday]echo %@owner[%fn]
BUILTIN\Administrators
[C:\Users\csgal\OneDrive\Desktop\JV16PT\thursday]icacls "%fn"
C:\Backup\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~19041.1415.1.6\amd64_microsoft-windows-a..g-whatsnew.appxmain_31bf3856ad364e35_10.0.19041.746_none_57c8601baf818c0d\f\new360videossquare44x44logo.targetsize-16_altform-unplated_contrast-black.png: The sy
stem cannot find the path specified.
Successfully processed 0 files; Failed processing 1 files
[C:\Users\csgal\OneDrive\Desktop\JV16PT\thursday]icacls %fn
C:\Backup\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~19041.1415.1.6\amd64_microsoft-windows-a..g-whatsnew.appxmain_31bf3856ad364e35_10.0.19041.746_none_57c8601baf818c0d\f\new360videossquare44x44logo.targetsize-16_altform-unplated_contrast-black.png: The sy
stem cannot find the path specified.
Successfully processed 0 files; Failed processing 1 files
[C:\Users\csgal\OneDrive\Desktop\JV16PT\thursday]
Not a clue! Are you csgal when you try that? Is OneDrive running? Maybe it locks files. If you have ProcessMonitor (sysinternals) you can monitor file system activity and get a better idea why it failed.
for %fn in (@thursday.txt) (
: list name - currently in %fn
: list attributes of %fn
: list owner of %fn
: subst p: %@path[%fn]
: run the icacls p:%@filename[%fn]
: SUBST p: /D
)
Or you couldHow about a BTM that would be of the form:
Code:for %fn in (@thursday.txt) ( : list name - currently in %fn : list attributes of %fn : list owner of %fn : subst p: %@path[%fn] : run the icacls p:%@filename[%fn] : SUBST p: /D )
CDD %@path[%fn]
and icacls %@filename[%fn]
Yes, it works.I wonder whethericacls %@sfn[%fn]
would work around the issue?