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.