Kanvas
Kanvas

Reputation: 185

How to rename disk label with spaces in Vbscript

Hi i have a disk whose label is "Local Disk". I am performing some action and formatting that disk ,want to rename that disk label to "Local Disk" but i am getting error in below line because of space in Local and Disk. I writing below code for that

strOutput = ExecuteDiskPartCommand("Format fs=ntfs label=”Local Disk” quick") // Error

strOutput = ExecuteDiskPartCommand("Format fs=ntfs label=”LocalDisk” quick") // No Error

How can i acheive this "Local Disk" in Vbscript?

Upvotes: 0

Views: 193

Answers (2)

Nico
Nico

Reputation: 1

Try this : strOutput = ExecuteDiskPartCommand("Format fs=ntfs label= & Chr(34) & "Local Disk" & Chr(34) & "quick")

Upvotes: 0

Papasmile
Papasmile

Reputation: 634

It looks like you need escaped quotes around "Local Disk":

strOutput = ExecuteDiskPartCommand("Format fs=ntfs label=""Local Disk"" quick")

Plus, I don't think space (alt-32) is allowed: http://msdn.microsoft.com/en-us/library/ms832054.aspx

Upvotes: 1

Related Questions