New
#11
What kind of proposition would you consider as a "solution"? Given that your concrete problem is not clear, I can't think of a concrete solution.
"Marking" files as viewed or not is not the task of a filesystem or Windows Explorer, to begin with, and I suppose that what's you're trying to do right?
One last from my part, use the archive attribute, enable the attributes column, and if it shows an "A", it's viewed. Remember to change it after you viewed it, under properties => Advanced => File for archiving (the first checkbox).
You granted the user named WATCHED full NTFS file access rights. The command that you issued has nothing to do with file ownership. Take a look at the help info for icacls:
Code:C:\>icacls /? ICACLS name /save aclfile [/T] [/C] [/L] [/Q] stores the DACLs for the files and folders that match the name into aclfile for later use with /restore. Note that SACLs, owner, or integrity labels are not saved. ICACLS directory [/substitute SidOld SidNew [...]] /restore aclfile [/C] [/L] [/Q] applies the stored DACLs to files in directory. ICACLS name /setowner user [/T] [/C] [/L] [/Q] changes the owner of all matching names. This option does not force a change of ownership; use the takeown.exe utility for that purpose. ICACLS name /findsid Sid [/T] [/C] [/L] [/Q] finds all matching names that contain an ACL explicitly mentioning Sid. ICACLS name /verify [/T] [/C] [/L] [/Q] finds all files whose ACL is not in canonical form or whose lengths are inconsistent with ACE counts. ICACLS name /reset [/T] [/C] [/L] [/Q] replaces ACLs with default inherited ACLs for all matching files. ICACLS name [/grant[:r] Sid:perm[...]] [/deny Sid:perm [...]] [/remove[:g|:d]] Sid[...]] [/T] [/C] [/L] [/Q] [/setintegritylevel Level:policy[...]] /grant[:r] Sid:perm grants the specified user access rights. With :r, the permissions replace any previouly granted explicit permissions. Without :r, the permissions are added to any previously granted explicit permissions. /deny Sid:perm explicitly denies the specified user access rights. An explicit deny ACE is added for the stated permissions and the same permissions in any explicit grant are removed. /remove[:[g|d]] Sid removes all occurrences of Sid in the ACL. With :g, it removes all occurrences of granted rights to that Sid. With :d, it removes all occurrences of denied rights to that Sid. /setintegritylevel [(CI)(OI)]Level explicitly adds an integrity ACE to all matching files. The level is to be specified as one of: L[ow] M[edium] H[igh] Inheritance options for the integrity ACE may precede the level and are applied only to directories. /inheritance:e|d|r e - enables inheritance d - disables inheritance and copy the ACEs r - remove all inherited ACEs Note: Sids may be in either numerical or friendly name form. If a numerical form is given, affix a * to the start of the SID. /T indicates that this operation is performed on all matching files/directories below the directories specified in the name. /C indicates that this operation will continue on all file errors. Error messages will still be displayed. /L indicates that this operation is performed on a symbolic link itself versus its target. /Q indicates that icacls should supress success messages. ICACLS preserves the canonical ordering of ACE entries: Explicit denials Explicit grants Inherited denials Inherited grants perm is a permission mask and can be specified in one of two forms: a sequence of simple rights: N - no access F - full access M - modify access RX - read and execute access R - read-only access W - write-only access D - delete access a comma-separated list in parentheses of specific rights: DE - delete RC - read control WDAC - write DAC WO - write owner S - synchronize AS - access system security MA - maximum allowed GR - generic read GW - generic write GE - generic execute GA - generic all RD - read data/list directory WD - write data/add file AD - append data/add subdirectory REA - read extended attributes WEA - write extended attributes X - execute/traverse DC - delete child RA - read attributes WA - write attributes inheritance rights may precede either form and are applied only to directories: (OI) - object inherit (CI) - container inherit (IO) - inherit only (NP) - don't propagate inherit (I) - permission inherited from parent container Examples: icacls c:\windows\* /save AclFile /T - Will save the ACLs for all files under c:\windows and its subdirectories to AclFile. icacls c:\windows\ /restore AclFile - Will restore the Acls for every file within AclFile that exists in c:\windows and its subdirectories. icacls file /grant Administrator:(D,WDAC) - Will grant the user Administrator Delete and Write DAC permissions to file. icacls file /grant *S-1-1-0:(D,WDAC) - Will grant the user defined by sid S-1-1-0 Delete and Write DAC permissions to file.
Hello Ridvan,
As UserNameIssues posted above, the command you used would only set permissions for the file. If you are not the owner or do not already have access rights, then the command would not be able to set permissions and is why you do not see the change in the file's properties.
You will need to take ownership of the file first, then grant permission. OPTION TWO in the tutorial below can help show you more on this.
Take Ownership of file
Hope this helps, :)
Shawn
@Brink,
I'm pretty sure that the OP is already the owner of these files.
The OP wants to give away file ownership to mark videos as having been watched.
Code:icacls D:\Folder\TvSeries\video.720p.mkv /setowner WATCHED
Add_Mark_as_WATCHED.reg
"Mark as WATCHED" can be changed to almost any desired text.Code:Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\*\shell\runas] [HKEY_CLASSES_ROOT\*\shell\runas] @="Mark as WATCHED" "Icon"="C:\\Windows\\System32\\imageres.dll,-78" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\*\shell\runas\command] @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /setowner WATCHED" "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /setowner WATCHED"
Remove_Mark_as_WATCHED.reg
If the OP wants more that one RunAs...Code:Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\*\shell\runas]
(e.g. wants take ownership and mark as watched)
...then something like this might work:
Multiple runas reg entries still possible? - Windows 7 - MSFN Forum
edit:
The reg file is just for the context menu for files.
I left the takeown commands just in case.
One is essentially taking ownership and then giving it away.
I have no idea what IsolatedCommand does. It does not seem to be needed, but I left it in since it is sprinkled all over the web when making these RunAs things.
The two reg files are in the attached zip.
Last edited by UsernameIssues; 13 Mar 2014 at 05:49.
@UsernameIssues
Thanks for the awesome solution. Works like charm!
edit: I tried to add this command in HKEY_CLASSES_ROOT\SystemFileAssociations\.mkv\Shell\Watched\command
it didn't work. Is it possible to add this command only for .mkv .avi .mp4 files? Either way I am happy.
Glad that it worked for you.
I don't see an easy way to make the context menu extension specific.
Maybe other forum members know of a way to do that.
I handled it now it's working exactly like I want.