Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use batch processing to realize that the mapping disk network disk is a fixed drive letter

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to use batch processing to achieve mapping disk network disk for fixed drive, Xiaobian thinks it is quite practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.

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 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 F drive letter first. If the command is successfully executed, the text will be output to output.txt.

diskpart> select volume f Select F disk, if successful, there will be an output showing that a certain disk is selected. Assumption: Volume 5

diskpart> remove the drive letter of the current selection disk

diskpart /s remove.txt > output.txt is to write the output content of diskpart to output.txt

2. Load the network disk

net use f: \\ip\dir Detailed usage I think the owner should be able to use, see net help use for specific help

3. Use output.txt to get volume 5

For execution process: The article goes over 6 lines and puts "Volume DiskPart successfully deleted the drive letter or mount point. read text as a delimiter, the number 5 is read into the variable %%i and assigned to the vol variable

4. Reload Volume 5

diskpart> select volume 5 Select volume 5, because we have removed the drive letter, so we can only use numbers, this is the role of output.txt

diskpart> assign Remove the drive letter of the current selection tray

About "how to use batch processing to achieve mapping disk network disk for fixed drive" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report