麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > VBScript > 正文

收藏的比較精典VBS代碼

2020-07-26 12:03:51
字體:
供稿:網(wǎng)友

文件操作

復(fù)制代碼 代碼如下:

Set fso = Wscript.CreateObject("Scripting.FileSystemObject") '創(chuàng)建文件系統(tǒng)對象,用以處理驅(qū)動(dòng)器、文件夾和文件
Set WshShell = Wscript.CreateObject("Wscript.Shell") '創(chuàng)建系統(tǒng)Shell對象,用以運(yùn)行程序等等
if fso.fileexists("D:/刀劍Online/alreadyexist.txt") then '如果找到文件“D:/刀劍 Online/alreadyexist.txt”則
WshShell.Run("D:/刀劍Online/刀劍Online.exe") '運(yùn)行“D:/刀劍Online/刀劍Online.exe”
elseif fso.fileexists("http://gengxin/update/dj.exe") then '否則,如果找到“//gengxin/update/dj.exe”則
WshShell.Run("http://gengxin/update/dj.exe") '運(yùn)行“//gengxin/update/dj.exe”
else
WshShell.Run("D:/刀劍Online/刀劍Online.exe") '否則運(yùn)行“D:/刀劍Online/刀劍Online.exe”
end if '根據(jù)條件執(zhí)行語句結(jié)束


VBS 導(dǎo)入注冊表,然后執(zhí)行文件
復(fù)制代碼 代碼如下:

dim Wsh Set Wsh = WScript.CreateObject("WScript.Shell")
Wsh.RegWrite "HKCU/SOFTWARE/AUDITION/AUTOSTART",0,"REG_DWORD"
Wsh.RegWrite "HKCU/SOFTWARE/AUDITION/PATH","G:/網(wǎng)絡(luò)游戲/勁舞團(tuán)1.5","REG_SZ"
Wsh.RegWrite "HKCU/SOFTWARE/AUDITION/VERSION",1010,"REG_DWORD" Wsh.run "patcher.exe"

PING內(nèi)網(wǎng) 不通就 執(zhí)行關(guān)機(jī) 的VBS
復(fù)制代碼 代碼如下:

strIP = "192.168.0.254" '被PING的內(nèi)網(wǎng)機(jī)器
Set objShell = CreateObject("WScript.Shell")
If Not IsOnline(strIP) Then objShell.run "shutdown -s -t 30 -c "&chr(34)&"機(jī)器即將關(guān)閉"&chr(34)
End If
Function IsOnline(strComputer) IsOnline = false strCommand = "%comspec% /c ping -n 2 -w 500 " & strComputer & "" Set objExecObject = objShell.Exec(strCommand) Do While Not objExecObject.StdOut.AtEndOfStream strText = objExecObject.StdOut.ReadAll() If Instr(strText, "Reply") > 0 Then IsOnline = true End If Loop End Function

開機(jī)腳本VBS用于ARP邦定
復(fù)制代碼 代碼如下:

Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.run "arp -s 192.168.0.1 30-18-e5-33-01",0
WshShell.run "arp -s 192.168.0.5 30-18-e5-33-07",0

運(yùn)行程序
復(fù)制代碼 代碼如下:

Dim a
Set Wsh = WScript.CreateObject("WScript.Shell")
a.Run "d:/網(wǎng)絡(luò)游戲/大話西游II/xy-2.exe"

運(yùn)行 oshell.run "d:/soft/hf/hfgame3/GameClient.lnk"

斷開網(wǎng)絡(luò)連接
復(fù)制代碼 代碼如下:

strNICName = " disable =net pci/*"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "devcon.exe"& strNICName
objShell.Run strCommand, 0, False


啟動(dòng)網(wǎng)絡(luò)連接
復(fù)制代碼 代碼如下:

strNICName = " enable =net pci/*"
Set objShell = CreateObject("Wscript.Shell")
strCommand = "devcon.exe"& strNICName
objShell.Run strCommand, 0, False

刪除文件的VBS腳本
復(fù)制代碼 代碼如下:

dim fso Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "http://server/共享/XXX.lnk","c:/目標(biāo)位置1/",true '添加
fso.CopyFile "http://server/共享/XXX.lnk","c:/目標(biāo)位置2/",true '添加
fso.DeleteFile "c:/目標(biāo)位置1/XXX.lnk" ,true '刪除 fso.DeleteFile "c:/目標(biāo)位置2/XXX.lnk" ,true '刪除
Set FSO=NoThing WScript.quit

無界面自動(dòng)檢測安裝iscsi客戶端,映射及斷開映射vbs腳本

下列代碼實(shí)現(xiàn)無界面自動(dòng)檢測安裝iscsi客戶端,自動(dòng)映射
復(fù)制代碼 代碼如下:

On Error Resume Next setupfile="iscsi2.0.exe" 'iscsi客戶端安裝文件路徑
serverip="192.168.0.100" 'iscsi服務(wù)器ip
Set oshell= CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
if not fso.fileexists(oshell.ExpandEnvironmentStrings("%WinDir%")+"/system32/iscsicpl.cpl")
then oshell.run setupfile&" /q",,1
end if
oshell.run "iscsicli AddTargetPortal "&serverip&" 3260",0,1
oshell.run "iscsicli LoginTarget iqn.2005-02.com.ricecake.iscsi:00 T * * * * * * * * * * * * * * * 0",0,1


下例代碼實(shí)現(xiàn)無界面刪除iscsi映射盤
復(fù)制代碼 代碼如下:

filetmp="c:/my.txt"
On Error Resume Next
Set Shell = CreateObject("WScript.Shell")
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
shell.run "cmd /c iscsicli sessionlist>"&filetmp,0,1
Const ForReading = 1
Dim fso, theFile, retstring
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile = fso.OpenTextFile(filetmp, ForReading)
aaa=thefile.readall
thefile.close
function myreadline()
X=instr(1,aaa,vbcrlf,vbTextCompare)
myline=mid(aaa,1,x-1)
aaa=right(aaa,len(aaa)-x)
if len(aaa) =<1 then myline ="end"
myreadline=myline
end function
Do While bbb<>"end"
bbb=myreadline
if bbb <> "end" then
if bbb <>" " then
if instr(bbb,"Session")<>0 then
temID=mid(bbb,instr(bbb,":")+1,len(bbb)-instr(bbb,":"))
shell.run "iscsicli logouttarget"&temID,0
end if
end if
end if
Loop
fso.deletefile(filetmp)


刪除QQ用戶文件強(qiáng)制刪除是不行的了,要跳過的話這樣:
復(fù)制代碼 代碼如下:

Dim fso, folderspec, f, f1, fc
folderspec = "f:/Program Files/Tencent/QQ" '設(shè)置你的QQ文件夾
Dim Re
Set Re = New RegExp
Re.Pattern = "^/d{4,13}$"
Set fso = CreateObject("scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc If Re.Test(f1.name) Then
On Error Resume Next
f1.Delete(true)
On Error GoTo 0
End If
Next

格5分鐘運(yùn)行一次批處理程序
復(fù)制代碼 代碼如下:

Dim Wsh
Set Wsh = WScript.CreateObject("WScript.Shell")
Do Wsh.Run "d:/aaa.bat" '你要執(zhí)行的批處理
WScript.Sleep(300000)
Loop

要設(shè)開機(jī)自動(dòng)運(yùn)行,禁止程序

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 久久不射电影 | 素人视频在线观看免费 | www.91在线 | 国产九色在线播放九色 | 性少妇videosexfreexxx片 | 草逼一区 | 国产99视频精品免视看9 | 亚洲成人第一区 | 亚洲成人黄色片 | 欧美一级做性受免费大片免费 | 欧美日韩电影 | 色欧美视频 | 草久影视 | 成人精品视频在线 | 亚洲一级成人 | 中文字幕综合在线观看 | 宅男噜噜噜66国产免费观看 | av电影直播 | 国产一精品一av一免费爽爽 | 91中文字幕在线观看 | 毛片免费在线播放 | 美女黄色毛片免费看 | 亚洲国产网址 | av成人在线电影 | 日本aaaa片毛片免费观看视频 | 少妇一级淫片免费放正片 | 国产午夜精品久久久 | 毛片视频网站 | 911视频免费版 | 欧美黄在线 | 一边吃奶一边摸下娇喘 | 99精品视频在线观看免费播放 | 精品国产一区二区三区在线观看 | 一级电影在线观看 | 日韩av成人| 欧美一级视频网站 | 国产午夜精品一区 | fc2成人免费人成在线观看播放 | 国产精品久久久久久模特 | 精品一区二区三区免费看 | 一级电影在线观看 |