Batch file program to copy folder from one drive to another.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yoda
    Contributor
    • Dec 2006
    • 291

    Batch file program to copy folder from one drive to another.

    This script needs to be copy folder lets say D:\windows\*me* to C:\windows\*me* . The problem I'm having is the *me* being a variable. So *me* always changes to who ever logs into the machine. So the real question is how to i make *me* in the file path change to whoever is logged in?

    Thanks in advance,

    Yoda.
  • tetrahedral
    New Member
    • Jul 2010
    • 7

    #2
    The %userprofile% variable refers to the currently logged in user's home directory (so the user's desktop would be "%userprofile%\ Desktop" for instance).

    Alternatively, %allusersprofil e% will work for all user accounts on that system.

    Hope this helps!

    Comment

    • Oralloy
      Recognized Expert Contributor
      • Jun 2010
      • 988

      #3
      Code:
      xcopy /s d:\windoze\%username% c:\windoze\%username%

      Comment

      • yoda
        Contributor
        • Dec 2006
        • 291

        #4
        Thanks so much tetrahedral and Oralloy that really helped me out, I'll post code when i'm done :)

        Thanks,

        Yoda

        Comment

        Working...