In Windows 7 getting error 'Access denied' when copying a file to system32 folder

I'd like to copy a file in the system32 folder on a Windows 7 using a batch file. Is there way to accomplish this? The file is will just be used as a as a hidden file that verifies the computer is from our company. I wanted to use the system32 path as both Windows XP and 7 have the same path for it. Any thoughts or suggestion?
 

Question Info


Last updated December 6, 2019 Views 101,090 Applies to:
Answer
Answer

Hi,

 

Due to Windows 7’s added security mechanism, you could be facing this permission issue.

Hence if you need to access, take ownership of the drive and assign rights or permission to the drive.


Here is guide on How to take ownership and grant permission in Window 7.

Make sure that you’ve logged in from Administrator account.

 

Step 1: Take ownership of the root drive:

 

Method 1: Take ownership of the drive from user interface.

 

a)      Right click on drive and select “Properties” from Context Menu.

b)      Click on "Security" tab.

c)       Click on “Advanced” button.

d)      Now click on "Owner" tab in Advanced Security Settings for User windows.

e)      Click on Edit Button and select user from given Change Owner to list if user or group is not in  given list.

f)       Click on other users or groups. Enter name of user/group and click ok.

g)      Now select User/group and click apply and ok. Check “Replace owner on subcontainers and objects” if you have files and folder within selected folder.

h)      Click ok when Windows Security Prompt is displayed.

i)        Now Owner name must have changed.

j)        Now click Ok to exist from Properties windows.

k)      Once you have taken the ownership of file or folder next part comes is granting permissions to that file/folder or object.

l)        If the above method doesn’t work, you could try taking ownership from the command line.

 

Method 2:

Taking ownership of a folder from command line

Open an elevated Command Prompt window.

 

To do so:

1. Go to > Start > All Programs > Accessories
2. Right-click on Command Prompt, and then click Run as Administrator.
3. Type the following command and press ENTER:

takeown /f <foldername> /r /d y

4. To assign the Administrators group Full Control Permissions for the folder, use this syntax:

icacls <foldername> /grant administrators:F /T

The /T parameter is added so that the operation is carried out through all the sub-directories and files within that folder.

5. To know more information about the above commands, run these commands from a Command Prompt window.

takeown /?
icacls /?

Once you take ownership, you can grant permissions on those folders.

 

Step 2: How to Grant Permissions in Windows

 

a)      Locate the drive on which you want to take ownership in windows explorer

b)      Right click on drive and select “Properties” from Context Menu

c)       Click on Edit button in Properties windows Click ok to confirm the prompt.

d)      Select user/group from permission windows or click “add” to add other user or group.

e)      Now under Permission section check the rights which you want to grant i.e check “Full

f)       Control” under the “Allow” column to assign full access rights control permissions to Administrators group.

g)      Click Ok for changes to take effect and click ok to exit from Properties window.

For more information, refer:



What are permissions?
http://windows.microsoft.com/en-us/Windows7/What-are-permissions

This should help you in copying the file in System32 folder.

 

Hope this helps,

John Rubdy
Forum Moderator | Microsoft Community

9 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Answer
Answer
You have to first check if you have permission to that folder and then you should be able to move it.

If you do not have permission then try and take ownership

1 person was helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.