Use batch processing to map the network disk of a disk to a fixed drive letter. Change the conflicting drive letter.

Source: Internet
Author: User

The FAQ previously submitted on csdn cannot be searched by the search engine and can only be found after a while. Currently, the csdn FAQ can only be accessed by csdn users and fixed to blog.

Http://faq.csdn.net/FAQUnfurl.aspx? Id = 216232

Q: Currently, 50 computers need to map a network driver. The network ing disk must be a f disk. The problem is that some computers currently have local f disks. You need to replace the drive letter of the local f disk with J, and then map the network drive to the f disk. Because there are many computers, I want to solve the problem by using batch files.

A:
---------------------------------------------------------------
You can use diskpart scripts.
Http://www.microsoft.com/technet/prodtechnol/windowsserver2003/zh-chs/library/ServerHelp/ca099518-dde5-4eac-a1f1-38eff6e3e509.mspx

Batch content:
Echo select volume F> remove.txt
Echo remove> remove.txt
Diskpart/s remove.txt> output.txt
Net use F: \ IP \ dir
Set Vol = 0
For/F "Skip = 6 delims = Volume diskpart successfully deleted the drive letter or mount point. "% I in (output.txt) do set Vol = % I
Echo select volume % vol %> assign.txt
Echo assign> assign.txt
Diskpart/s assign.txt
Del remove.txt
Del assign.txt
Del output.txt
---------------------------------------------------------------

1) Remove the fdisc first, and the command will output to output.txt if the execution is successful.
Diskpart> select volume F select disk F. If the disk is selected successfully, the output shows that a disk is selected. Assume that volume 5 is selected.
Diskpart> remove
Diskpart/s remove.txt> output.txt is used to write the output content of diskpartto output.txt.

2. Attach a Network Disk
Net use F: \ IP \ dir detailed usage I think the landlord should use it. For more information, see net help use.

3rd, use output.txt to obtain the Volume 5
For execution: six rows are passed, and the drive letter or mount point of the volume diskpart is deleted successfully. Read the text as a separator, the number 5 will be read to the variable % I, and then assigned to the vol variable

4. Reload Volume 5
diskpart> select Volume 5 select Volume 5 because we have removed the disc and can only use numbers. The role of output.txt
diskpart> assign removes the drive letter of the selected disk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.