- 论坛徽章:
- 0
|
如何编写一个shell可以在win2000下调用NET SEND发送多条消息。
保存为test.vbs
Dim host, message, count, i, cmd
Ent=chr(13)&chr(10)
Set Args = wscript.Arguments
Set ws=WScript.CreateObject("wscript.shell"
If Args.Count() = 3 Then
host = Args.item(0)
message = Args.item(1)
count = Args.item(2)
Else
Call DisplayUsage
End If
i = 0
cmd = "net send " & host & " " & message
While i < int(count)
WScript.Echo "send to " & host & " " & i+1
ws.run cmd,0
i = i+1
Wend
Sub DisplayUsage
WScript.Echo "Usage: test.vbs host message count" & Ent & "Example: test.vbs 192.168.0.1 你好 10"
WScript.Quit (1)
End Sub
执行
D:\>cscript test.vbs 192.168.0.5 "test message" 3 |
|