Get the App
SLTechnology News&Howtos  ›  Development  › 

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

Shulou Source: shulou.com Published: 2022-06-03 19:33:13 10月03日 Update

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!

Tags: Articles examples analysis mixing content scripts face-to-face processing research not much commands most truth slashes solutions more best knowledge industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL OPPO Reno Huawei Docker Apple