Using batch to implement the mapped disk network disk as a fixed letter, change the conflicting hard drive letter _dos/bat

Source: Internet
Author: User

Previously submitted on the CSDN FAQ, not through the search engine to search the CSDN FAQ, find a good time to find. Now CSDN FAQ only CSDN users to normal access, solid to blog.

http://faq.csdn.net/FAQUnfurl.aspx?id=216232

Q: The existing 50 computers need to map a network drive, the network mapping disk must be F disk. The problem is that some computers already have a local f disk, the need to replace the local F disk Letter J, and then map the network drive to the F disk. Because the computer is many, therefore wants to use the batch processing file to solve.

A:
---------------------------------------------------------------
You can use the DiskPart script
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 removed 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, first remove the F disk letter, command If successful execution will output text to Output.txt
Diskpart> Select volume F Select the F disk, the successful words will have output display select a disk to assume: Volume 5
Diskpart> Remove the letter of the currently selected disk.
DISKPART/S Remove.txt >output.txt is to write DiskPart output to the output.txt.

2. Load Network disk
NET use F: \\ip\dir detailed usage think the landlord should be used, specifically help see Net helps

3, using Output.txt to obtain volume 5
For execution: Line over 6 lines, and the volume DiskPart successfully removed the drive letter or mount point. "Read the text as a delimiter, and then read the number 5 into the variable%%i and assign it to the Vol variable.

4, Reload Volume 5
Diskpart> Select Volume 5 Choose Volume 5, because we have removed the letter, so we can only use numbers, which is the role of output.txt
Diskpart> assign to remove the currently selected disk letter.

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.