{"id":1551,"date":"2013-08-14T19:41:05","date_gmt":"2013-08-14T17:41:05","guid":{"rendered":"http:\/\/www.samlogic.net\/blog\/?p=1551"},"modified":"2019-07-07T21:47:52","modified_gmt":"2019-07-07T21:47:52","slug":"how-to-give-a-standard-user-write-permission-to-a-folder-in-program-files","status":"publish","type":"post","link":"https:\/\/www.samlogic.net\/blog\/2013\/08\/how-to-give-a-standard-user-write-permission-to-a-folder-in-program-files\/","title":{"rendered":"How to give a standard user write permission to a folder in Program Files"},"content":{"rendered":"<p>In Windows Vista, Windows 7 and Windows 8 the <strong>Program Files<\/strong> folder and the <strong>Program Files (x86)<\/strong> folder (and all subfolders beneath) are read-only folders for standard users (users that run programs with standard privileges). This means it is not possible for them to create files or update files in this location of the hard disk. The folders are write-protected. Why these folders are write-protected is explained in this <a href=\"https:\/\/www.samlogic.net\/articles\/installation-program-windows-vista-7.htm\">technical article<\/a> on our website.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.samlogic.net\/blog\/images\/product-visual-installer\/program-files-and-program-files-x86-folder.png\" alt=\"The 'Program Files' and 'Program Files (x86)' folder\"><\/p>\n<p>We sometimes get the question: is it possible to circumvent the write protection and allow also standard users write access to a folder beneath <strong>Program Files<\/strong> and <strong>Program Files (x86)<\/strong>?<\/p>\n<p>The answer is: Yes, it is possible. You can do it by changing the permission settings for the folder.<\/p>\n<p>This should always be the last resort if you can not find another way. All folders placed in <strong>Program Files<\/strong> and <strong>Program Files (x86)<\/strong> should be write-protected for standard users, but sometimes this can give problems to older legacy software. In some computers a virtualization system called <strong>VirtualStore<\/strong> can solve the problem, but in many computers this is turned off. And then it is impossible to write data to a file. A file can be neither created nor updated.<\/p>\n<p>You should note that it requires a user with administrator rights to change the permission settings for a folder in <strong>Program Files<\/strong> and <strong>Program Files (x86)<\/strong>. A standard user can not change any permissions.<\/p>\n<p><strong>How do I change the permission settings for a folder?<\/strong><br \/>\nThis can be done in different ways. One method is just to right click on the folder in Windows Explorer, choose the <strong>Properties<\/strong> menu item, open the <strong>Security<\/strong> tab, select the <strong>Users<\/strong> item and change permissions for the user.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.samlogic.net\/blog\/images\/product-visual-installer\/windows-7-properties-security-tab.gif\" alt=\"The 'Properties' dialog box in Windows\"><\/p>\n<p>Although this is achievable, this is not a user-friendly solution for end-users. Especially not for users that are not so familiar with computers. A much better method is to change the permissions programmatically.<\/p>\n<p><strong>Let the installation program change the permission settings<\/strong><br \/>\nAs mentioned above, the permissions should be changed programmatically, and the best method is to let the installation program change the permission settings. When a software is installed to the <strong>Program Files<\/strong> \/ <strong>Program Files (x86)<\/strong> folder, the setup program is always run with administrator rights. This means that the installation program is allowed to change permission settings for a folder. If you try to change the permission settings later, for example when the installed software is running, it is very likely that the software do not have administrator rights. It will very likely only have standard user access rights, and it can therefore not change any permission settings for folders in <strong>Program Files<\/strong> \/ <strong>Program Files (x86)<\/strong>.<\/p>\n<p><strong>How Visual Installer can handle this<\/strong><br \/>\n<img decoding=\"async\" class=\"alignright\" src=\"https:\/\/www.samlogic.net\/pad\/icons\/visual_installer.gif\" border=\"0\" alt=\"\">In our setup tool <a href=\"https:\/\/www.samlogic.net\/visual-installer\/visual-installer.htm\">Visual Installer<\/a> there is a special script command that can be used to change permission settings for a folder. The name of the command is <strong>SETPERM<\/strong>, and below you can see an example of how to use the script command:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.samlogic.net\/blog\/images\/product-visual-installer\/visual-installer-execute-script-commands-setperm-cropped.gif\" alt=\"The 'Execute script commands' dialog box in Visual Installer\"><\/p>\n<p><strong>%DESTDIR\\MyDataFolder<\/strong> is a path to a folder that will have its permissions changed and <strong>PERM_ALL<\/strong> tells Visual Installer to give a standard user full access rights to the folder (including write access). Instead of <strong>PERM_ALL<\/strong> you can also use <strong>PERM_WRITE<\/strong> as a second parameter. <strong>PERM_WRITE<\/strong> will give the standard user write access to the folder, but no other permission settings are changed.<\/p>\n<p><strong>%DESTDIR<\/strong> is variable that contains the main destination folder for the installation. If for example the main destination folder is <strong>C:\\Program Files\\SamLogic\\My Application<\/strong>, the full path to the folder entered above will be <strong>C:\\Program Files\\SamLogic\\My Application\\MyDataFolder<\/strong>.<\/p>\n<p><strong>Related information<\/strong><br \/>\n<strong><span style=\"color: #ff0000;\">&gt;<\/span><\/strong> <a href=\"https:\/\/www.samlogic.net\/blog\/2012\/09\/install-files-correct-folder-visual-installer\/\">How to install files in the correct folder using Visual Installer<\/a><br \/>\n<strong><span style=\"color: #ff0000;\">&gt;<\/span><\/strong> <a href=\"https:\/\/www.samlogic.net\/visual-installer\/tips\/tips-pages\/visual-installer-scripting-language\/visual-installer-scripting-language.htm\">Visual Installer&#8217;s Scripting Language<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Windows Vista, Windows 7 and Windows 8 the Program Files folder and the Program Files (x86) folder (and all subfolders beneath) are read-only folders for standard users (users that run programs with standard privileges). This means it is not possible for them to create files or update files in this location of the hard &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.samlogic.net\/blog\/2013\/08\/how-to-give-a-standard-user-write-permission-to-a-folder-in-program-files\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to give a standard user write permission to a folder in Program Files&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[15],"tags":[],"_links":{"self":[{"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/posts\/1551"}],"collection":[{"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/comments?post=1551"}],"version-history":[{"count":1,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/posts\/1551\/revisions"}],"predecessor-version":[{"id":6147,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/posts\/1551\/revisions\/6147"}],"wp:attachment":[{"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/media?parent=1551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/categories?post=1551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.samlogic.net\/blog\/wp-json\/wp\/v2\/tags?post=1551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}