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

Re: Formatting Flash Drives via VBScript by Pegasus

Pegasus
Fri May 02 18:09:16 CDT 2008


"Donald Moreno" <dwmorenojr@att.net> wrote in message
news:Xns9A927253B3D84dwmorenojrattnet@207.115.33.102...
> 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

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!



Re: Formatting Flash Drives via VBScript by Donald

Donald
Fri May 02 20:16:29 CDT 2008

"Pegasus \(MVP\)" <I.can@fly.com.oz> wrote in
news:OHzvNmKrIHA.5068@TK2MSFTNGP02.phx.gbl:

>
> "Donald Moreno" <dwmorenojr@att.net> wrote in message
> news:Xns9A927253B3D84dwmorenojrattnet@207.115.33.102...
>> 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
>
> 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!
>
>
>

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

Re: Formatting Flash Drives via VBScript by Pegasus

Pegasus
Sat May 03 00:17:39 CDT 2008


"Donald Moreno" <dwmorenojr@att.net> wrote in message
news:Xns9A92CE976F54Ddwmorenojrattnet@207.115.17.102...
> "Pegasus \(MVP\)" <I.can@fly.com.oz> wrote in
> news:OHzvNmKrIHA.5068@TK2MSFTNGP02.phx.gbl:
>
>>
>> "Donald Moreno" <dwmorenojr@att.net> wrote in message
>> news:Xns9A927253B3D84dwmorenojrattnet@207.115.33.102...
>>> 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
>>
>> 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!
>>
>>
>>
>
> 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

Thanks for the feedback.