Administrator getting "access denied" - unable to create directory

As far as I can tell, I am in the Administrators group on Windows 7 Service Pack 1. verified this way

With CMD prompt pinned to my Start menu, I rightmouse and select Run as Admin and get this error on xcopy:

C:\>xcopy "C:\Users\TRA\My Documents" J:\MyDocuments1-TRA /E /I /Y /M
Access denied
Unable to create directory - J:\MyDocuments1-TRA
0 File(s) copied

Using Windows Explorer, I can navigate to both the C drive and the J drive (an external HD) and create New Folders and within them create new files and save content inside the file. I think the syntax on XCOPY is correct.

I am a little uncertain about wrapping the first parameter in double quotes (think that is correct). The main mystery is why access denied. Thanks.

EDIT - UPDATE: More info about external drive, etc.

There is no domain - just Windows 7 - connection to "J" drive is USB. I can dig out more info on SATA or whatever if needed. Home network only. No domain controller. I did this:

C:\>net use
New connections will be remembered.
There are no entries in the list.
C:\>
C:\>dir /al Volume in drive C is OS Volume Serial Number is 366C-7FCC Directory of C:\ 07/14/2009 01:08 AM <JUNCTION> Documents and Settings [C:\Users] 0 File(s) 0 bytes 1 Dir(s) 622,991,994,880 bytes free
C:\>j:
J:\>dir /al Volume in drive J is SignatureMini Volume Serial Number is 18E1-4B50 Directory of J:\ File Not Found

UPDATE: "the Big Picture" - my objective here:

I'm just trying to get a "backup" command to run once per day and copy new and/or modified files. I got this XCOPY command in a scheduled task on another Windows 7 PC working nicely. I have had mysterious problems using Windows 7 Backup facility (I guess because this is Home Premium edition and my research suggests this is not supported). Thanks for your time folks. I will press on and appreciate your suggestions/ideas.

5

2 Answers

When you're in an admin prompt, you have to remap the drive. You can see that you don't have a J: in your admin prompt by typing net use (it'll say unavailable in the first column of output).

Compare that to the net use output from a standard prompt, where you'll have "OK" in the first column.

I haven't tried this, but this technet article suggest you can have the map work by modifying the registry:

1. Click Start, type regedit in the Start programs and files box, and then press ENTER.
2. Locate and then right-click the registry subkey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.
3. Point to New, and then click DWORD Value.
4. Type EnableLinkedConnections, and then press ENTER.
5. Right-click EnableLinkedConnections, and then click Modify.
6. In the Value data box, type 1, and then click OK.
7. Exit Registry Editor, and then restart the computer.
3

I think your problem comes from dealing with junctions and/or symlinks: directories that are not such, but some link, like in the Unix ln command.
You can see junctions by typing:

dir /al

Different copy-programs deal with junctions/symlinks with different behaviors, for what I know.
I propose you two possibilities:

  • Install something like Link Shell Extension that is designed to work with all this stuff. According to its documentation, it adds command-line shell extensions too.
  • Use normal directories(folders). Do not use symlinks/junctions for your data if possible (I hate them). You could make a mess when copying data. Even the awesome Total Commander doesn't copy/duplicate by default all the contents/structure of directories. I know this seems hard, but it is a lot safer. Symlinks(junctions could be needed for the working of Windows structure, but don't rely on them for your data storage.

This thread shows an example of the complexity when copying data if there are symlinks/junctions involved.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like