用VBS來代替BAT或CMD文件進行命令第1/2頁
2019-10-26 18:00:55
供稿:網友
 
				自動導入注冊表的,帶檢測: 
On Error Resume Next 
dim msg,fso,shell 
Set fso = Wscript.createobject("scripting.filesystemobject") 
set wshshell = wscript.CreateObject("wscript.shell") 
set shell = wscript.createobject("wscript.shell") 
IF (fso.FileExists("e:/勁樂團/reg.reg")) Then  
shell.run "c:/windows/Regedit.exe /s e:/勁樂團/reg.reg " 
shell.run "e:/勁樂團/O2Jam.exe"  
Else 
msg=msgbox("注冊表未導入,游戲可能無法啟動,如無法進游戲請叫網管~",1,"出問題啦!!") 
shell.run "e:/勁樂團/O2Jam.exe" 
end if 
不帶檢測的: 
On Error Resume Next 
Dim oShell,fso 
Set oShell = WScript.CreateObject("WScript.Shell") 
set fso = CreateObject("Scripting.filesystemobject") 
oShell.Run "regedit /s 9you.reg"  
oShell.Run "d:/網絡游戲/勁樂團/O2Jam.exe" 
自動加載虛擬光驅的: 
Dim oShell 
Set oshell= WScript.CreateObject("WScript.Shell") 
oShell.Run "c:/progra~1/daemon~1/daemon.exe -mount 0,D:/lan/戰地2/BF2CD1mini.mds" 
wscript.sleep 5000 
oShell.Run "D:/lan/戰地2/BF2.exe" 
另一例子: 
Dim Wsh,DMpath,ISOpath 
DMpath = "X:/Y/daemon.exe" '設置DM路徑 
ISOpath = "Z:/大富翁七/RICH7B.mds" '設置鏡像文件路徑 
Set Wsh = WScript.CreateObject("WScript.Shell") 
Wsh.run chr(34) & DMpath & chr(34) &" -mount 0,"&ISOpath,0,true 
Wscript.Sleep 3000 '最好延時幾秒等待鏡像加載完畢 1000 = 1 秒 
Wsh.run "Z:/大富翁七/rich7.exe"  
Set WSH = Nothing 
WScript.quit 
//每次開機的時候自動導入注冊表和程序 
Option Explicit 
Dim Folder 
Folder = "d:/aaa" '設置你要執行的文件夾 
Dim Wsh,fso 
Set Wsh = WScript.CreateObject("WScript.Shell") 
Set fso = CreateObject("Scripting.FileSystemObject") 
Dim f,fc,f1,ext 
Set f = fso.GetFolder(Folder) 
Set fc = f.Files 
For Each f1 in fc 
ext = LCase(fso.GetExtensionName(f1)) 
Select Case ext 
Case "exe" 
wsh.run f1,,true 
Case "reg" 
wsh.run "Regedit /s "& f1,,true 
end Select 
Next 
Set fso=NoThing 
Set Wsh = Nothing 
WScript.quit 
//排除指定文件或文件夾刪除多余的文件或文件夾,黑火原創 
Option Explicit 
''''''''''''''說明'''''''''''' 
'網盟-黑火制作,送給需要的朋友。 
'配置文件“Listfile.ini”的格式如下: