如何使用VBS代码将D盘下所有文件和文件夹复制到E盘?

2025-01-06 15:02:29
推荐回答(2个)
回答1:

Option Explicit
dim i,fso
Set fso=CreateObject("Scripting.FileSystemObject")
fso.CopyFolder "d:\*","e:\"
fso.CopyFile "d:\*","e:\"

以上是vbs代码,对于类似的文件处理,个人感觉使用批处理更好些。

回答2:

Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "d:\*" , "e:\ ",
objFSO.CopyFolder "d:\*" , "e:\ " , OverWriteFiles
OverwriteExisting