title: How to install Remove Drive for use in batch file
body: <p><strong>Pay attention to the "2nd EDIT", that's where the real question is now.</strong></p>
  
  <p>I'm trying to add a bit to a batch file that will safely remove an external drive from my computer. After looking through questions on here that asked the same question, I concluded that <code>Remove Drive</code> was my best option. I downloaded the file and I used <a href="http://www.thewindowsclub.com/safely-remove-usb-devices-removedrive-free-commandline-tool" rel="nofollow noreferrer">this tutorial</a> to install the contents. However, this didn't install <code>Remove Drive</code> so that I can use it in a batch file. Can anyone explain how to do this or how I can find an appropriate tutorial?</p>
  
  <p><strong>EDIT</strong>: 
  I put the 64bit version of <code>RemoveDrive.exe</code> into my <code>System32</code> folder. This made it so that <code>RemoveDrive</code> was now a recognized command in the cmd window. If I typed in <code>RemoveDrive :E</code> into the console, it would successfully remove the external <code>E:</code> drive. However, when I added the line <code>RemoveDrive E:</code> to my batch file, it acted as if I had only typed in <code>RemoveDrive</code> and displayed the help information at the end of my script. Any ideas why this happened? Is there another method to implement RemoveDrive in a batch file that I'm not seeing in the documentation?</p>
  
  <p><strong>2nd EDIT</strong>: I added the path to the function i.e. <code>C:\Windows\System32\RemoveDrive E: -L</code>. This changed the results from simply showing the <code>/?</code> information to making an actual attempt to run the function and remove the external drive. However, it failed. I used the <code>-L</code> to try to remove it safely again if it fails. It ends up "trying....." for long enough that its not going to work. I have the option to hit <code>esc</code> to cancel the attempt or <code>E</code> to "eject media" (I'm not sure what's different about this option and letting it "Try" again. When I hit <code>E</code>, it ultimately results in a "<code>SUCCESS</code>" However, it doesn't actually remove the drive, i.e. I can still access it and all the files.</p>
  
  <p>I tried testing the function in a solo batch file which works fine. </p>
  
  <pre><code>@echo off
  `C:\Windows\System32\RemoveDrive E: -L`
  </code></pre>
  
  <p>My guess, is that its because the rest of the batch file I'm trying to run it in, is copying files from the external drive and moving files to the external drive. I'm guessing that its reading the open console window as an "active" connection to the drive which means it can't safely disconnect. Is there anything I can do in a batch file that would let me disconnect any "connections" to the drive?</p>