{"id":178,"date":"2012-06-29T12:59:15","date_gmt":"2012-06-29T10:59:15","guid":{"rendered":"https:\/\/www.npcglib.org\/~stathis\/blog\/?p=178"},"modified":"2013-10-01T05:54:55","modified_gmt":"2013-10-01T03:54:55","slug":"reset-permissions-on-windows-7-files","status":"publish","type":"post","link":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/","title":{"rendered":"windows task: Reset permissions on Windows 7 files"},"content":{"rendered":"<p>Sometimes when moving from one Windows computer to another with a removable drive or I upgrade an older windows system and reuse a partition from the old system, some files and folders may be inaccessible. Typically, Windows will pop up a window with the message &#8220;You need permission to perform this action&#8221; and further details of the user that can grant you these permissions. For instance trying to delete a directory will yield a similar window: <div id=\"attachment_420\" style=\"width: 496px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/folder_access_denied.png\"><img aria-describedby=\"caption-attachment-420\" loading=\"lazy\" src=\"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/folder_access_denied.png\" alt=\"Folder Access Denied\" title=\"Folder Access Denied\" width=\"486\" height=\"295\" class=\"size-full wp-image-420\" srcset=\"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/folder_access_denied.png 486w, https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/folder_access_denied-300x182.png 300w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/><\/a><p id=\"caption-attachment-420\" class=\"wp-caption-text\">Insufficient rights to delete a folder<\/p><\/div><\/p>\n<p>The steps to take full control of the files again and carry on with the action you were intended to do requires of course Administrator rights. I use this two-step process: <\/p>\n<p>(a) First take ownership of the directory, and its contents (recursively), in question:<\/p>\n<pre>\r\ntakeown \/F &lt;dir&gt; \/R \/D y\r\n<\/pre>\n<p>(b) Despite being the owner, you also need to have permissions to do what you are intended to do. Best is to allow Administrators full control:<\/p>\n<pre>\r\nicacls &lt;dir&gt; \/grant Administrators:F \/T\r\n<\/pre>\n<p><\/p>\n<h2> Right-click > Expropriate > Rinse > Repeat<\/h2>\n<p>Here is, upfront, the batch file that creates the Expropriate entry in the context menu: <\/p>\n<p>I like to have useful commands available in the context menu when right-clicking a directory. To turn the above two-step process into a right-click menu command, first create the context menu entry by executing from a Windows Command line:<\/p>\n<pre>\r\nreg add HKEY_CLASSES_ROOT\\Directory\\shell\\Expropriate \/ve \/f \/d \"Expropriate dir\"\r\n<\/pre>\n<p>Then for the command to be executed when you click on that entry, execute (<u>all in one line<\/u>):<\/p>\n<pre>\r\nreg add HKEY_CLASSES_ROOT\\Directory\\shell\\Expropriate\\command \r\n        \/ve \/t REG_EXPAND_SZ \/f \/d \"%%comspec%% \/c takeown \/F %%1 \/R \/D y &amp;&amp;\r\n        icacls %%1 \/grant Administrators:F \/T\"\r\n<\/pre>\n<p>The command will be available whenever you right-click a directory from within Windows Explorer, as shown in the figure below.<br \/>\n<div id=\"attachment_427\" style=\"width: 381px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/expropriate-right-click.png\"><img aria-describedby=\"caption-attachment-427\" loading=\"lazy\" src=\"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/expropriate-right-click.png\" alt=\"Expropriate right-click context menu command\" title=\"Expropriate right-click context menu command\" width=\"371\" height=\"168\" class=\"size-full wp-image-427\" srcset=\"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/expropriate-right-click.png 371w, https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/expropriate-right-click-300x135.png 300w\" sizes=\"(max-width: 371px) 100vw, 371px\" \/><\/a><p id=\"caption-attachment-427\" class=\"wp-caption-text\">Expropriate right-click context menu command, allows you to take ownership and set correct permissions with the click of a button!<\/p><\/div><\/p>\n<p>You can also download the batch script <a href=\"\/~stathis\/downloads\/expropriate-dir-cmd.bat\" title=\"expropriate command batch script\">expropriate-dir-cmd.bat<\/a> and run it (at your own risk) to create the relevant keys in your registry for the Expropriate command.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes when moving from one Windows computer to another with a removable drive or I upgrade an older windows system and reuse a partition from the old system, some files and folders may be inaccessible. Typically, Windows will pop up a window with the message &#8220;You need permission to perform this action&#8221; and further details [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[21,19,22],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"description\" content=\"Reset the permissions of files and folders with a mouse click on Windows!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"stathis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#website\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/\",\"name\":\"sigmoid\",\"description\":\"..oo..oo..oo..oo..oo..oo..\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/folder_access_denied.png\",\"contentUrl\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/folder_access_denied.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#webpage\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/\",\"name\":\"windows task: Reset permissions on Windows 7 files - sigmoid\",\"isPartOf\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#primaryimage\"},\"datePublished\":\"2012-06-29T10:59:15+00:00\",\"dateModified\":\"2013-10-01T03:54:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41\"},\"description\":\"Reset the permissions of files and folders with a mouse click on Windows!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"windows task: Reset permissions on Windows 7 files\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41\",\"name\":\"stathis\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g\",\"caption\":\"stathis\"},\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/author\/stathis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"description":"Reset the permissions of files and folders with a mouse click on Windows!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/","twitter_misc":{"Written by":"stathis","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#website","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/","name":"sigmoid","description":"..oo..oo..oo..oo..oo..oo..","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.npcglib.org\/~stathis\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#primaryimage","inLanguage":"en-US","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/folder_access_denied.png","contentUrl":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-content\/uploads\/2012\/06\/folder_access_denied.png"},{"@type":"WebPage","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#webpage","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/","name":"windows task: Reset permissions on Windows 7 files - sigmoid","isPartOf":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#primaryimage"},"datePublished":"2012-06-29T10:59:15+00:00","dateModified":"2013-10-01T03:54:55+00:00","author":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41"},"description":"Reset the permissions of files and folders with a mouse click on Windows!","breadcrumb":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2012\/06\/29\/reset-permissions-on-windows-7-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.npcglib.org\/~stathis\/blog\/"},{"@type":"ListItem","position":2,"name":"windows task: Reset permissions on Windows 7 files"}]},{"@type":"Person","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41","name":"stathis","image":{"@type":"ImageObject","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#personlogo","inLanguage":"en-US","url":"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g","caption":"stathis"},"url":"https:\/\/www.npcglib.org\/~stathis\/blog\/author\/stathis\/"}]}},"_links":{"self":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/178"}],"collection":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/comments?post=178"}],"version-history":[{"count":15,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions"}],"predecessor-version":[{"id":1214,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions\/1214"}],"wp:attachment":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/media?parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/categories?post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/tags?post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}