WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Format a disk on Windows 2000 or Windows XP

 Keywords: Format Drive Disk 2K XP 2000 

Question:

I'm trying to format a drive with NTFS, an external USB drive. Someone here mentioned that I should just use Format.com, which using this syntax:
Format.com e: /FS:NTFS /V:VolumeLabel /Q /Y
Works beautifully in WinXP. THANK YOU!!

Problem is, I need a different solution for windows 2000, because the older version of Format.com prompts me for the current volume label, and does not recognize the "/Y" parameter.

Does anyone have any suggestions on how to step around this little mess? I'd prefer something native to WB, but maybe some WMI solution?

Any help would be greatly appreciated.

Answer:

; Format a disk on Windows 2000 or Windows XP
; Les Ferch, April 23, 2008
; Change RunWait to RunHideWait for silent operation

#DefineFunction Format(Vol,FS,Label)
If !DiskExist(Vol) Then Return
VolName = DiskVolinfo(Vol:"\",1)
Temp = Environment("Temp")
Comspec = Environment("Comspec")
FormatDat = Temp:"\Format.dat"
FilePut(FormatDat,VolName:@CRLF:"Y":@CRLF:"Y":@CRLF)
RunWait(Comspec,'/c format ':Vol:' /fs:':FS:' /v:':Label:' /q <"':FormatDat:'"')
FileDelete(FormatDat)
#EndFunction

Format("E:","NTFS","MyDisk")

Article ID:   W17926
Filename:   Format a disk on Windows 2000 or Windows XP.txt
File Created: 2008:04:24:07:34:54
Last Updated: 2008:04:24:07:34:54