Is there any code in VBScript that I can use to copy a file(s) in all physical drives at once without giving the driveletter(in a single line or two)?
The problem is that I couldnot find any VBS code that I could use to copy a single file to all physical drives & removable drives in a single line/sentence(s). I don't know much about VBS and I donot use any VB6/VB.net and I don't want to learn those VB6 or VB.net anyway.
Well, if you have any such code in batch also, please do mention it. If anyone knows the code, please explain in detail.
I do know about how to copy file in drives one by one (in VBS) but I don't know how to do it all at once in 1 line code.
Exactly 5 hours earlier, I asked this very question and pasted it on this forum. But, I have discovered it myself using IsReady is the answer. The code would be
' This Sample copies the vbs file to all the existing drives.
' This sample gives an error "File already exists" since it finds a copy of itself already present in 1 of drives
' Using seperate name for duplicate copy prevents the error
' overwrite code maynot be working
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives
For Each objDrive in colDrives
If objDrive.IsReady = True Then
objfso.CopyFile "filename.vbs" , objDrive.DriveLetter+":\" , overwriting = true