Batch File to copy directory with if statements

I'm trying to make a batch file for some new interns to use when they are doing a simple profile copy. I am pretty new when it comes to batching. I did a little bit back in the day but don't remember hardly any of it. Basically all the users are getting upgraded to new computers and I just want it to create a batch file that will copy the user's directory to an External HDD (E) and they move the External HDD to the new computer and copy the user's directory to the new computer. This is what I have so far and I'm pretty sure it's all jacked because it doesn't work, lol.

@echo off
set /p copyorrestore= Are you copying or restoring a profile? Enter 1. For Copy Enter 2. For Restore?
set /p user=Enter user's logon name?
if %copyorrestore%=="1" goto copy
if %copyorrestore%=="2" goto restore
COPY /G /S /Y C:\Users\%user% E:\
COPY /G /S /Y E:\%user% C:\Users\
8 answers Last reply Best Answer
More about batch file copy directory statements
  1. Why not use USMT or the Transfer Wizard? User migration is precisely what they are there for.
  2. We are making so it's less interaction and interference as possible. Quick and no prompts. Login, double click, move to the next machine. So please can someone help. I realize there is a lot of software out there for this but this will also help improve my batching.
  3. Best answer
    All your batch does is move user data. USMT and the Transfer Wizard also migrate program and user settings, which will reduce the time necessary to migrate to a new system. A USMT environment can be pre-configured to run exactly as you are requesting (just double-click and move on). All it takes is a little up front time.

    An example: I can connect 2 computers with a patch cable in a p2p configuration, launch my pre-built USMT tool on both, designate source/destination, click the "GO" button, and walk away. Networking is set up and user profiles are migrated (30GB in ~20 minutes on a 1Gig connection). At that point users can log in and all of their settings and customizations are intact (including wallpaper). Even .pst files are re-connected to Outlook (if there were any previously). No further hands on are required.
  4. That sounds great, and I think I will go with that method on the second phase but I guess I did forget to mention one thing... they are moving from XP to 7 and a lot of the software preinstalled on the new machines images or either successors of the XP version or we decided to go to a totally new equivalent software. So user data is really all we are looking at moving at the time. But I will definitely use that when we do our Production and Marketing Dept. They are already on 7.
  5. USMT will migrate from XP to either Vista or Win 7, and from 32-bit to 64-bit (just not the other way). Even program settings from such things as Office 2007 to 2010/2013. You're actually doing things the hard way. Work smarter, not harder.
  6. OK, sweet! Then that sounds like the way to go then. I'm think I'll use that. Not really familiar with USMT but will allow it to save to an External and then restore to a new machine? We have a handful of programs that won't migrate I'm sure but that wouldn't be a big deal.
  7. Yes, it can do all that, and more. The reference is here:

    Just be aware that the learning curve is somewhat steep. However, once you get your head wrapped around it you'll wonder how you ever got along without it. Also be aware that programs are not, and cannot be, migrated. Only settings, data, and user profiles are migrated.
  8. That shouldn't be a problem. We have program migration under control... the images of 7 will already have the programs preinstalled. We well figure out something else for the new programs that will be coming along. Thanks
Ask a new question

Read More

DOS Batch Shell Script Windows 7