[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Rewrite this batch file to select correct user in xcopy

Posted on 2007-08-09
6
Medium Priority
?
597 Views
Last Modified: 2008-01-09
I am trying to write a batch file that I can put on the Netlogon share on the server.  But it has to accomodate everyone's user profile.  The following works great for copying MyDocuments of the user: "scottv"

xcopy "C:\Documents and Settings\scottv.CENTRAL\My Documents\*.*" \\192.168.254.146\public\ /c /f /h /d /y /o /s /e

However, I want to be rewrite this script so that it selects the CURRENT user, because it will be a shared file by all users on the server.  
0
Comment
Question by:al4629740
6 Comments
 
LVL 22

Expert Comment

by:Christopher McKay
ID: 19666383
"C:\Documents and Settings\%username%\My Documents\*.*" \\192.168.254.146\public\ /c /f /h /d /y /o /s /e


That should do it for you.

:o)

Bartender_1
0
 
LVL 22

Assisted Solution

by:Christopher McKay
Christopher McKay earned 600 total points
ID: 19666391
forgot the xcopy:

xcopy "C:\Documents and Settings\%username%\My Documents\*.*" \\192.168.254.146\public\ /c /f /h /d /y /o /s /e
0
 
LVL 58

Expert Comment

by:amit_g
ID: 19666393
xcopy "C:\Documents and Settings\%UserName%\My Documents\*.*" \\192.168.254.146\public\ /c /f /h /d /y /o /s /e
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 97

Accepted Solution

by:
Lee W, MVP earned 1400 total points
ID: 19666429
Sorry, those won't work for vista or installs that are non-standard.

Instead, why don't you use %userprofile%?

xcopy "%userprofile%\My Documents\*.*" "\\192.168.254.146\public\" /c /f /h /d /y /o /s /e

Or better still, why don't you use a combination of Document Redirection and Offline files?
0
 

Author Comment

by:al4629740
ID: 19667643
How do you use document redirection?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question