Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Formatting Flash Drives via VBScript

349 views
Skip to first unread message

Donald Moreno

unread,
May 2, 2008, 12:12:16 PM5/2/08
to
Is it possible to format a Flash drive via VBScript. My ultimate goal is
to format several flash drives at the same time or syncronously through
script.

I do backups from several computers via USB Flash Drives on a 4 port hub..
After the backups are done, I would like to format these drives by VBScript
and not through windows formatting program as it takes too long to select
the drive and format for several drives.

Any help would be greatly appreciated. I have search google, hotbot, and
yahoo. But all examples and help are for fixed disks and my scripts error
out.

Thanx, Don

Pegasus (MVP)

unread,
May 2, 2008, 7:09:16 PM5/2/08
to

"Donald Moreno" <dwmor...@att.net> wrote in message
news:Xns9A927253B3D84...@207.115.33.102...

If there is a "format" method in VB Script then I'm not aware of it.
You could use the following batch file instead. It will format all
attached removable drives.
01. @echo off
02. echo > "%temp%\vbs.vbs" Set objSWbemServices = GetObject("winmgmts:\\.")
03. echo >>"%temp%\vbs.vbs" Set colSWbemObjectSet =
objSWbemServices.InstancesOf("Win32_LogicalDisk")
04. echo >>"%temp%\vbs.vbs" For Each objSWbemObject In colSWbemObjectSet
05. echo >>"%temp%\vbs.vbs" If UCase(objSWbemObject.Description) =
"REMOVABLE DISK" _
06. echo >>"%temp%\vbs.vbs" Then WScript.Echo objSWbemObject.DeviceID
07. echo >>"%temp%\vbs.vbs" next
08.
09. for /F %%a in ('cscript //nologo "%temp%\vbs.vbs"') do (
10. echo Formatting drive %%a
11. echo format %%a /q /y
12. )
Remove the word "echo" in Line 11 to activate the batch file.
Warning: Do not activate the batch file until you're absolutely
sure that it does what you want it to do. Use it at your own risk!


Donald Moreno

unread,
May 2, 2008, 9:16:29 PM5/2/08
to
"Pegasus \(MVP\)" <I....@fly.com.oz> wrote in
news:OHzvNmKr...@TK2MSFTNGP02.phx.gbl:

This is exactly what I was trying to accomplish. I'v done this similar
thing with echoing to write a program in UNIX. Didn't know you could do
this in windows. THINK of ALL the POSSIBLILITIES!!!

Thanks for all your help...
Don

Pegasus (MVP)

unread,
May 3, 2008, 1:17:39 AM5/3/08
to

"Donald Moreno" <dwmor...@att.net> wrote in message
news:Xns9A92CE976F54D...@207.115.17.102...

Thanks for the feedback.


0 new messages