Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying the contents of a user desktop?

Status
Not open for further replies.

alankeno

MIS
Nov 1, 2002
2
0
0
US
Hi All,
In an effort to automate the copying of files from a user "documents and settings" desktop, I started with this batch.
MD P:\__ForMove\Desktop (P: is a mapped resource)
COPY "%Userprofile%\Desktop *.*" P:\__ForMove\Desktop
:EXIT

__ForMove\Desktop is created, but nothing is copied from the %Userprofile%\Desktop. (you know, all the junk the users leave on their desktops)
What am I doing wrong here?

TIA, Alan
 
My mapped drive is "H" change it to your "P". I believe you wanted to copy everything which is an XCOPY command.

rem Batch File to Backup Selected Folders and Files to mapped drive
set temp=
set tempDr=
set temp=%username%
if exist H:\ (set tempDR=H)
if exist H:\ (mkdir H:\MyDesktop)
if exist "C:\Documents and Settings\%temp%\Desktop" (xcopy "C:\Documents and Settings\%temp%\Favorites" "%tempDr%:\MyDesktop" /E)
set Temp=
set tempDr=
End
 
Did you consider security privilages?

If ran from task scheduler, is it set in admin profile w/ password?

If running from server, do you have it "run as" set properly?

As far as your code....
Code:
MD P:\__ForMove\Desktop
COPY "%Userprofile%\Desktop *.*" P:\__ForMove\Desktop
:EXIT

Try this little bit of change
Code:
MD P:\__ForMove\Desktop
COPY "%Userprofile%\Deskto[b][COLOR=red]p\*[/color][/b].*" P:\__ForMove\Desktop
:EXIT


Let us know what works (or NOT works).
--MiggyD

--> It's a bird! It's a plane! No, it's an OS update patch! Ahh!! <--
 
Any luck?

--> It's a bird! It's a plane! No, it's an OS update patch! Ahh!! <--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top