title: Is there a way to have a .bat script copy files and folders from one drive to another?
body: <p>I am trying to copy a file and folder from on my flash drive to the desktop of any computer I plug it into. I am somewhat familiar with the command line and batch scripts but have not used it for doing file manipulation in this way. </p>
  
  <p>I originally wrote a script to test copy it from my flash drive to my desktop, however, the issue is on a new computer I won't always have the same drive letter assigned.</p>
  
  <p>The code I used to test copy everything with known drive letters where the script starts in the folder on my flash drive where what I want to copy is:</p>
  
  <pre><code>copy aFile.file C:\Users\*user*\Desktop
  </code></pre>
  
  <p>where <em>user</em> is my user folder. </p>
  
  <p>The main issue I am running into right now is copying things from one drive to another where it needs to go into a user profile</p>
  
  <p>cd has the /D switch which specifically specifies to switch drives.
  so</p>
  
  <pre><code>cd /D %userprofile%\Desktop
  </code></pre>
  
  <p>goes to the active user's Desktop... right where I want it. 
  whereas</p>
  
  <pre><code>cd %userprofile%\Desktop
  </code></pre>
  
  <p>does nothing because users are on a separate drive. </p>
  
  <p>Is there something similar to /D for copy? The main issue is that drives letters change and user names change. 
  User name changes are easy to deal with because I can use %userprofile\Desktop. </p>
  
  <p>If we assumed that copy made use of the same switches as cd (it doesn't) then what I basically want is:</p>
  
  <pre><code>copy /D aFile.file %userprofile%\Desktop
  </code></pre>
  
  <p>I am sure I am missing something relatively simple but I didn't see any switches that seemed to be what I need. 
  I am also open to using robocopy if that would be easier, but attributes (timestamp, owner, etc) don't matter to me so I didn't think it would benefit me immediately.</p>