Batch File Naming

I am looking for a command to rename multiple disks, which I map to each run in WinXP. I have a part of the mapping, I'm now interested in calling them user names programmatically, so I can keep them in direct form.

+4
source share
2 answers

I abandoned DOS and studied PowerShell instead. The end result worked as follows:

$Net = New-Object -ComObject WScript.Network $Rename = New-Object -ComObject Shell.Application #### # Map the local drives Subst Q: 'C:\File Path\Uno' Subst U: 'C:\File Path\Dos' #### # Map the network drives $Net.MapNetworkDrive("X:", '\\Server\File Path\Uno') $Net.MapNetworkDrive("Y:", '\\Different Server\File Path\Dos') #### # Rename everything $rename.NameSpace("Q:\").Self.Name = 'Network -> FOO' $rename.NameSpace("U:\").Self.Name = 'Network -> BAR' $rename.NameSpace("X:\").Self.Name = 'Local -> FOO' $rename.NameSpace("Y:\").Self.Name = 'Local -> BAR' 
+4
source

At the command prompt, type:

 LABEL x: yourlabel 

Where x: is the letter of your drive, and yourlabel is the name you would like to have.

From LABEL /? :

 Creates, changes, or deletes the volume label of a disk. LABEL [drive:][label] LABEL [/MP] [volume] [label] drive: Specifies the drive letter of a drive. label Specifies the label of the volume. /MP Specifies that the volume should be treated as a mount point or volume name. volume Specifies the drive letter (followed by a colon), mount point, or volume name. If volume name is specified, the /MP flag is unnecessary. 

Edit: As @mark noted, this does not work with mapped drives. This seems to be a common problem, and there may be a way to achieve this using the registry, or a little easier using a small vbs script .

+2
source

Source: https://habr.com/ru/post/1436449/


All Articles