External Drive Letter - Backup

蓝咒 提交于 2019-12-11 08:18:00

问题


I am writing a PowerShell script that will back up several folders from my Vista drive to an external USB drive, using robocopy.
Windows does not guarantee that it will always assign the same drive letter to the external drive.
What is the best way to get around this problem?
How do I code the destination paths?

Thanks.


回答1:


Windows could change that drive letter assigned to your USB drive.
The correct way to do this backup is mounting the USB drive in an empty directory. Not only does it add some consistency to swapped storage, it also allows for a persistent shortcut on a Windows desktop.

That's how to:

  1. Run "diskmgmt.msc" from Windows' Run/Start Search box,
  2. Right-click on your plugged-in drive and choose "Change Drive Letter and Paths."
  3. Remove the current drive letter assigned to your drive.
  4. Click on the Add button
  5. Select Mount into the following empty NTFS folder and click on browse.
  6. Now navigate to the subfolder that you want to assign the USB drive to and confirm the assignment.

The USB drive will from now on be accessible from that folder (if it is connected to the computer of course).
Now you can change your script to select, as destination folder, the folder with the mounted drive and forget the drive letter persistence.




回答2:


Use can use "Drive Letter View" available free at http://www.nirsoft.net/utils/drive_letter_view.html to assign desired drive letter to external drive. From this moment on, the selected removable media will always be mounted with same letter. (Test with windows 8.1)

Towards commercial side "Zentimo storage" at http://www.zentimo.com is the best solution.

or

Use Diskpart diskpart> list volume

select volume n assign letter=T i.e the new letter.




回答3:


Are you sure it's impossible? (I don't have an external hard drive to test now). I think that if you right-click on "computer", then select manage, you can select a letter for an hard drive that will allways be the same for this disk.

However, can't you use the serial number of the disk?

(sorry if my explanations weren't well explained, I'm not a native english speaker)



来源:https://stackoverflow.com/questions/9967012/external-drive-letter-backup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!