-2

I'm trying to deploy shortcuts from xcopy using a batch script to c:\users\all users\desktop But this is a hidden folder with Hide Protected operating System files tick box under Folder options.

I need to run a command to allow me access copy a file to this directory.

So far I've tried running attrib -h c:\users\all users\, but it hasn't helped.

Any help would be greatly appreciated.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Jaoibh
  • 1
  • 4
  • Do you get an error message? – MichelZ Apr 09 '14 at 16:15
  • No the command completed successfully but that's only because it wasn't the correct command to run. The Attrib command doesn't seem to remove the tick box for "hide Protected OS System Files" – Jaoibh Apr 09 '14 at 16:16
  • No, when you xcopy the files into that directory, you probably get an error, else you wouldn't ask this question I asume. – MichelZ Apr 09 '14 at 16:18
  • Of course.. command I'm running is: xcopy "c:\NOCapps1\Shortcuts\*.*" c:\Users\All Users\Desktop Error: Invalid Number of Parameters 0 File(s) copied... I run the same command but point it to my profile and it works. – Jaoibh Apr 09 '14 at 16:23
  • 1
    Try putting the second one in " as well: `xcopy "c:\NOCapps1\Shortcuts*.*" "c:\Users\All Users\Desktop"` this is most likely the error ("All Users" has a space, your profile probably doesn't) – MichelZ Apr 09 '14 at 16:31
  • Using your suggestion I get Access denied – Jaoibh Apr 09 '14 at 17:13
  • OK, now we're a step further. Do you have access to the directory? (ACL)? – MichelZ Apr 09 '14 at 17:31
  • @Jaoibh 1. this flag has no effect on batch files, it's only for Windows Explorer. 2. In addition to @MichelZ advice, you should have administrator privilegies to write to public desktop (and don't change these permissions to avoid messing something by mistake) 3. To successfully XCOPY , see XCOPY /?. I usually use a lot of flags to copy well (like `/E /C /I /G /H /K /Y`) – LogicDaemon Apr 09 '14 at 19:01

2 Answers2

1

C:\Users\All Users in windows 7 is a Symlink to the C:\ProgramData folder. The C:\Programdata\desktop folder is a junction back to c:\users\public\desktop.

If you are trying to copy data to the "all users\desktop" folder, try copying the shortcut directly to the C:\users\public\Desktop folder.

Rex
  • 7,895
  • 3
  • 29
  • 45
  • problem is non-quoted path with spaces and lack of privilegies, not a symlink. – LogicDaemon Apr 09 '14 at 19:02
  • I've tried xcopy "c:\NOCapps1\shortcuts\*.*" "c:\programdata\desktop" and I get access denied I've also tried copying directly to the public\desktop folder and get access denied also. – Jaoibh Apr 10 '14 at 09:33
-1

Off the back of @MichelZ, @Rex and @LogicDaemon's suggestions I found the solution

xcopy "c:\NOCapps1\shortcuts\*.*" /i "c:\users\public\public desktop\"
MadHatter
  • 79,770
  • 20
  • 184
  • 232
Jaoibh
  • 1
  • 4
  • The problem isn't resolved copying to the Public desktop doesn't put the files on every users desktop as I'd hoped. – Jaoibh Apr 10 '14 at 16:41