XCOPY Access Denied: How to Fix This Error

Enabling XCOPY is often very effective for most users

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team Read more

Key notes

  • XCOPY is a command-line utility available in Windows operating systems that allows you to copy files and directories from one location to another.
  • Permission issues are the most significant cause for access denied when using the command.

If you attempt to copy files or folders with the XCOPY command but lack the required permissions, you may encounter the XCOPY access denied error. We explore this issue and recommend some solutions in this guide.

You may also want to check out our other extensive guide that tells you what to do when an unexpected error keeps you from copying files on your computer.

Why do I get the XCOPY access denied error?

The most common reasons include the following:

  • You do not have sufficient permission to copy the folders or files.
  • The folder or file source and destination are on separate drives where you do not have permission.
  • XCOPY command is disabled on the computer.
  • There is a problem with the source or destination documents or directories.

You will need the terminal for most of our preferred solutions, so check out our detailed guide if you can not open the Command Prompt as an admin.

How can I fix the XCOPY access denied error?

Before you try the solutions, we recommend this quick workaround:

  • Reopen the Command Prompt with administrative privileges and retry the command.
  • Double-check permissions for both the source and destination files or folders.

If you still do not have success, proceed to the solutions below.

1. Enable XCOPY

  1. Press Windows + R to open the Run dialog.
  2. Type cmd and hit Ctrl + Shift + Enter to open an elevated Command Prompt.
    xcopy access denied
  3. Type in the script below and hit Enter.
    reg add "HKCU\Environment" /v PATH /t REG_EXPAND_SZ /d "%PATH%;C:\Windows\System32"
  4. Input Yes to overwrite and hit Enter.
  5. Finally, try the command again and verify that you no longer receive an XCOPY access denied message.

2. Take ownership of the file or folder

  1. Press Windows + R to open the Run dialog.
  2. Type cmd and hit Ctrl + Shift + Enter to open an elevated Command Prompt.xcopy access denied
  3. Input in the script below and hit Enter, replacing C:\Users\username\Desktop\file.txt with your file path and name.
    takeown /f C:\Users\username\Desktop\file.txt
    xcopy access denied
  4. Type in the below script and hit Enter to grant full control, also replacing C:\Users\username\Desktop\file.txt with your file path and name:
    icacls C:\Users\username\Desktop\file.txt /grant username:F
    xcopy access denied
  5. Lastly, rerun your XCOPY command and see if the solution fixes the XCOPY access denied issue.

3. Use the T or Y parameters

  1. Press Windows + R to open the Run dialog.
  2. Input cmd and hit Ctrl + Shift + Enter to open an elevated Command Prompt.xcopy access denied
  3. Type the script below and hit Enter, replacing <source destination> with the file directory and name. If you’re attempting to copy a directory but lack permission to copy the files within it, utilizing the /T parameter is helpful.
    xcopy <source destination> /T
  4. Optionally, you may replace /T with /Y to suppress the prompt for confirmation if a file already exists in the destination.

These steps are quite easy to follow; if you have followed them properly, you should have no other issues with denying XCOPY access.

You may look at our other comprehensive article if you can not move files on your computer. Lastly, if you think we skipped any solutions, please let us know in the comment section below.

More about the topics: file sharing, files