VBS and BAT mixing Modify the volume label _dos/bat of a virtual letter

Source: Internet
Author: User

I want to change the volume label of the virtual drive that I created with subst.
The following command is known to be unable to change the letter created by subst

@echo off
subst x:c:\personalfiles
wmic 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 unfamiliar with ...
I changed it so that it was not effective:

@echo off
subst x:c:\personalfiles
mshta vbscript:createobject ("Shell.Application"). NameSpace ("X:\"). Self.name = "Development"

Now want to ask how to modify the above script to be effective? Thank you.

BTW: I just want to study the disposal plan of the batch.

After some research, I finally got it done.

: On Error Resume Next
Sub bat
Echo & CLS
' &subst x:c:\personalfiles
start Wscript-e:vbs '%~f 0 "
Exit Sub End
sub
Set oshell = WScript.CreateObject (" shell.application ")
oshell.namespace (" X:\ "). Self.name = "Personal Files"

Explain it, the backslash to escape, the best words should be at the beginning of every line Plus ' & to deal with.

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.