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