Hi,

I installed Windows 8. I have write a personal script (.bat file) which worked with Windows 7 perfect. The problem on Windows 8 is:

My script executes this command:

xcopy "D:\X" "D:\E" /S /E /I /Q /H /K /O /X

xcopy is Windows's copy command.
"D:\X" is source directory
"D:\E" is destination direcotory
/S /E /I /Q /H /K /O /X are other parameters.

I got "access denied" error.

I check the properties of the directories "D:\X" and "D:\E". On the "security" tab of properties, "Authenticaed Users", "SYSTEM", "Administrators" ve "Users (computerName/Users)" all got "Full control" enabled.

I got "access denied" error even when I log on as admin. The .bat file works just when I run it as administator.

But all other users need to run this .bat file without password. It just executes something simple. Copy a file to another directory.

I will be happy if you can help me.

Thanks in advance..

Dani AI

Generated

Note for (and ): the behavior you describe — the batch only succeeding when you explicitly “Run as administrator” — is caused by Windows UAC and the copy options that try to preserve NTFS security metadata. Membership in the Administrators group does not mean the process runs elevated; a non‑elevated shell has a filtered token and cannot set owners/audit info. Copy operations that attempt to preserve ownership/ACLs require special privileges, so they fail with “Access is denied” unless the process is elevated.

Practical, low‑risk fixes

  • If you do not need to preserve owners/audits, stop trying to copy that security metadata. Use a tool that copies only file data/attributes/timestamps (no owner/ACL) — for example:

    robocopy "D:\X" "D:\E" /E /COPY:DAT /R:2 /W:5

    That will avoid the elevated‑privilege requirement. After the copy, fix destination permissions if needed:

    icacls "D:\E" /grant "Users:(OI)(CI)F" /T

When preserving security metadata is required

  • Run the copy from an elevated context created once by an admin: a scheduled task or a service running as LOCAL SYSTEM or an admin account. Create the task with “Run with highest privileges” and an On‑demand trigger; the admin creates it one time, then normal users can invoke that task (or a small helper) to perform the elevated copy without entering a password. Alternatively, perform the copy during maintenance while logged in elevated.

Quick troubleshooting checklist

  • Confirm which account the .bat actually runs as (add whoami to its output).
  • Check for EFS (encrypted) files or open file locks.
  • If you still see failures, use Process Monitor to capture the specific Access Denied NTSTATUS and which privilege is missing — that pinpoints whether it’s an owner/ACL issue or a simple permission/lock problem.

.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.