copying My Documents to USB drive by batch file

Discussion in 'Software' started by nfv111, Sep 11, 2008.

  1. nfv111

    nfv111 Private E-2

    A few users are really getting on my nerves. They act like having a USB thumb drive is some uncomprehensive and futuristic device. I've tried explaining to these morons that it's just like another drive letter and you can copy and paste to it the same way. Some just dont get it and still track me down and ask me to back things up to it for them. It is sad. Thus my reason for this post.

    This batch below which will copy the My Documents folder to an H: drive. In this case H: is on a USB drive. I was wondering if there is a way to not hard code the letter H and use a wildcard perhaps to map automatically to a USB drive and then copy. I dont know if its possible. I just know at some point the letter H will get assigned to something else and then they'd act like the sky was falling or something when they got an error copying. The net use * command still needs a \\name\share to map so I dont know if that is what I want. Any thoughts?

    Thanks
    nfv111

    cd C:\windows\system32
    xcopy "%USERPROFILE%\MyDOCU~1\*.*" "H:\My Documents" /e /Y /h /c /i /r
     
  2. PC-XT

    PC-XT Master Sergeant

    You could check to see if H:\My Documents, or a particular file that could otherwise identify the USB drive, exists before copying, and if not, display a message like, Please insert the USB drive. You could have it try drive letters until it finds the drive. This does require new drives to be initialized with the identifier file.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds