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

Example Analysis of Modification of Virtual Drive letter by mixed programming of vbs and bat

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Xiaobian to share with you vbs and bat mixed to modify the virtual drive letter example analysis, I believe that most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

I want to change the volume label of the virtual drive letter I created with subst

It is known that the following command cannot change the drive letter created by subst

Echo offsubst X: C:\ personalfileswmic logicaldisk where "deviceid='X:'" set volumename= "Development" pause

But you can use this vbs script to change

Set oShell = WScript.CreateObject ("Shell.Application") oShell.NameSpace ("X:\"). Self.Name = "Development"

To be honest, VBS is not familiar with.

It didn't work when I changed it like this:

Echo offsubst X: C:\ personalfilesmshta _ vbscript:CreateObject ("Shell.Application") .NameSpace ("X:\") .Self.Name = "Development"

Now would like to ask how to modify the above script to take effect? Thank you.

BTW: I just want to study the batch processing scheme.

After some research, I finally got it.

: On Error Resume NextSub batecho off & cls'&subst X: C:\ personalfilesstart wscript-e:vbs "% ~ f0" Exit SubEnd SubSet oShell = WScript.CreateObject ("Shell.Application") oShell.NameSpace ("X:\"). Self.Name = "Personal Files"

To be clear, the best way to escape a backslash is to add'& to deal with it at the beginning of each line.

The above is all the contents of the article "sample analysis of vbs and bat mixed editing and modifying virtual drive letters". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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