几个超有价值的VBS脚本
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
几个超有价值的VBS脚本!
2008-08-20 12:13
1、exe2swf工具用法:将exe格式的flash拖放在此vbs文件上,即可生成swf文件
dim AsoR,FlashFileName
Set ArgObj = WScript.Arguments
dim PositionStart,OKed,Tag,EndSize
PositionStart = 920000'flash 4的播放器的大致字节数
EndSize = 8 'exe文件结尾字节数,其它版本可以设置为0 FlashFileName = ArgObj(0)'传递路径
set AsoR=CreateObject("Adodb.Stream")
AsoR.Mode=3
AsoR.Type=1
AsoR.Open
set AsoW=CreateObject("Adodb.Stream")
AsoW.Mode=3
AsoW.Type=1
AsoW.Open
AsoR.LoadFromFile(FlashFileName)
OKed = true
dim filesize
filesize = AsoR.size
if filesize>PositionStart then
while OKed
AsoR.Position = PositionStart
Tag = Bin2Str(AsoR.read(20))
if instr(Tag,"0000000") >0 then
PositionStart = PositionStart + 1
else
PositionStart = PositionStart + 20
end if
if Tag = "00000000000000000708783" or Tag = "00000000000000000678783" then
OKed = false
end if
'if PositionStart > filesize then
' OKed = false
'end if
wend
else
msgbox "文件错误"
end if
PositionStart = PositionStart + 16
'msgbox PositionStart
AsoR.Position = PositionStart
AsoW.write AsoR.read(filesize-int(PositionStart)-int(EndSize))
'新文件名
dim newFileName
'newFileName = left(FlashFileName,len(FlashFileName)-4) & ".swf" newFileName = FlashFileName & ".swf"
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(newFileName)) Then
overwrite = msgbox(newFileName&" 已存在"& vbnewline &"要替换它吗?",308,"文件已经存在 - exe2swf脚本")
if overwrite=6 then
AsoW.SaveToFile newFileName, 2
else
msgbox "操作被取消",0,"exe2swf脚本"
end if
else
AsoW.SaveToFile newFileName, 1
end if
AsoR.close
set AsoR=nothing
AsoW.close
set AsoW=nothing
Function Bin2Str(Bin)
Dim I, Str
For I=1 to LenB(Bin)
clow=MidB(Bin,I,1)
if ASCB(clow)<128 then
Str = Str & (ASCB(clow))
else
I=I+1
if I <= LenB(Bin) then Str = Str & (ASCW(MidB(Bin,I,1)&clow)) end if
Next
Bin2Str = Str
End Function
2、更改3389远程桌面端口
Set WshShell=CreateObject("Wscript.Shell")
Function Imput()
imputport=InputBox("请输入一个端口号,注意:这个端口号目前不能被其它程序使用,否则会影响终端服务"," 更改终端端口号", "3389", 100, 100) If imputport<>"" Then
If IsNumeric(imputport) Then
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp\PortNumber",imputport,"REG_DWORD" WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber",imputport,"REG_DWORD" wscript.echo "操作成功"
Else wscript.echo "输入出错,请重新输入"
Imput()
End If
Else wscript.echo "操作已经取消"
End If
End Function
Imput()
set WshShell=nothing
3、黑人必会!强制杀进程!对付杀毒软件啊
'备注:vbs强制关闭程序
'防止出现错误
On Error Resume Next
'vbs代码开始----------------------------------------------
sub Close_Process(ProcessName)
On Error Resume Next
for each ps in
getobject("winmgmts:\\.\root\cimv2:win32_process").instances_ '循环进程
if Ucase()=Ucase(ProcessName) then
ps.terminate
end if
next
end sub
Close_Process("notepad.exe") ' notepad.exe是记事本程序的进程,你可以换成其他进程名字