Next: GetDetailsOf
From: Frank on
Hi,

I have the following 2 ways to send a message to specified IP address. However, how can I modified it so that I can pass ip address and message as variable to the wshShell.run method?

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("%comspec% /k net send 10.0.0.11 ""Messages to be send"""), 0
objShell.Run("net send 10.0.0.11 Disk Space Checked, please see the log file"), 0

Thanks
Frank
From: Joe Fawcett on
"Frank" <signup0702(a)sina.com> wrote in message
news:eNbQwnCDFHA.2568(a)TK2MSFTNGP10.phx.gbl...
Hi,

I have the following 2 ways to send a message to specified IP address.
However, how can I modified it so that I can pass ip address and message as
variable to the wshShell.run method?

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("%comspec% /k net send 10.0.0.11 ""Messages to be send"""), 0
objShell.Run("net send 10.0.0.11 Disk Space Checked, please see the log
file"), 0

Thanks
Frank

Dim IP
Dim sMessage
IP = InputBox ("Enter the target IP address:", "Net Send Utility",
"127.0.0.1")
sMessage = InputBox("Enter the message to send:", "Net Send Utility",
"Hello, World")
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("%comspec% /k net send " & IP & """" & sMessage & """"), 0

You may want to check returns from InputBox to see if user hsa cancelled,
use IsEmpty(IP) or IsEmpty(sMessage).

--

Joe (MVP)



From: Frank on
Hi Joe,

I followed your guide as below, however it does not seem to execute net send
although wscript.echo can output the value. Can you further enlighten me?

IP = "10.0.0.11"
sMessage = "hello world"
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("%comspec% /c net send " & IP & """" & sMessage & """"), 0
objShell.Run("net send" & IP & """" & sMessage & """"), 0
WScript.Echo IP
WScript.Echo sMessage


Thanks
Frank

"Joe Fawcett" <joefawcett(a)hotmail.com> wrote in message
news:ufupm5DDFHA.4072(a)TK2MSFTNGP10.phx.gbl...
> "Frank" <signup0702(a)sina.com> wrote in message
> news:eNbQwnCDFHA.2568(a)TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I have the following 2 ways to send a message to specified IP address.
> However, how can I modified it so that I can pass ip address and message
as
> variable to the wshShell.run method?
>
> Set objShell = WScript.CreateObject("WScript.Shell")
> objShell.Run("%comspec% /k net send 10.0.0.11 ""Messages to be send"""), 0
> objShell.Run("net send 10.0.0.11 Disk Space Checked, please see the log
> file"), 0
>
> Thanks
> Frank
>
> Dim IP
> Dim sMessage
> IP = InputBox ("Enter the target IP address:", "Net Send Utility",
> "127.0.0.1")
> sMessage = InputBox("Enter the message to send:", "Net Send Utility",
> "Hello, World")
> Set objShell = WScript.CreateObject("WScript.Shell")
> objShell.Run("%comspec% /k net send " & IP & """" & sMessage & """"), 0
>
> You may want to check returns from InputBox to see if user hsa cancelled,
> use IsEmpty(IP) or IsEmpty(sMessage).
>
> --
>
> Joe (MVP)
>
>
>


From: Joe Fawcett on
A space is missing:
objShell.Run "%comspec% /c net send " & IP & " """ & sMessage & """", 0,
false

--

Joe (MVP)

"Frank" <signup0702(a)sina.com> wrote in message
news:u5ry5eFDFHA.2232(a)TK2MSFTNGP14.phx.gbl...
> Hi Joe,
>
> I followed your guide as below, however it does not seem to execute net
> send
> although wscript.echo can output the value. Can you further enlighten me?
>
> IP = "10.0.0.11"
> sMessage = "hello world"
> Set objShell = WScript.CreateObject("WScript.Shell")
> objShell.Run("%comspec% /c net send " & IP & """" & sMessage & """"), 0
> objShell.Run("net send" & IP & """" & sMessage & """"), 0
> WScript.Echo IP
> WScript.Echo sMessage
>
>
> Thanks
> Frank
>
> "Joe Fawcett" <joefawcett(a)hotmail.com> wrote in message
> news:ufupm5DDFHA.4072(a)TK2MSFTNGP10.phx.gbl...
>> "Frank" <signup0702(a)sina.com> wrote in message
>> news:eNbQwnCDFHA.2568(a)TK2MSFTNGP10.phx.gbl...
>> Hi,
>>
>> I have the following 2 ways to send a message to specified IP address.
>> However, how can I modified it so that I can pass ip address and message
> as
>> variable to the wshShell.run method?
>>
>> Set objShell = WScript.CreateObject("WScript.Shell")
>> objShell.Run("%comspec% /k net send 10.0.0.11 ""Messages to be send"""),
>> 0
>> objShell.Run("net send 10.0.0.11 Disk Space Checked, please see the log
>> file"), 0
>>
>> Thanks
>> Frank
>>
>> Dim IP
>> Dim sMessage
>> IP = InputBox ("Enter the target IP address:", "Net Send Utility",
>> "127.0.0.1")
>> sMessage = InputBox("Enter the message to send:", "Net Send Utility",
>> "Hello, World")
>> Set objShell = WScript.CreateObject("WScript.Shell")
>> objShell.Run("%comspec% /k net send " & IP & """" & sMessage & """"), 0
>>
>> You may want to check returns from InputBox to see if user hsa cancelled,
>> use IsEmpty(IP) or IsEmpty(sMessage).
>>
>> --
>>
>> Joe (MVP)
>>
>>
>>
>
>


From: Frank on
Thank you Joe.

regards,
Frank

"Joe Fawcett" <joefawcett(a)hotmail.com> wrote in message
news:eYJYhVGDFHA.2180(a)TK2MSFTNGP10.phx.gbl...
> A space is missing:
> objShell.Run "%comspec% /c net send " & IP & " """ & sMessage & """", 0,
> false
>
> --
>
> Joe (MVP)
>
> "Frank" <signup0702(a)sina.com> wrote in message
> news:u5ry5eFDFHA.2232(a)TK2MSFTNGP14.phx.gbl...
> > Hi Joe,
> >
> > I followed your guide as below, however it does not seem to execute net
> > send
> > although wscript.echo can output the value. Can you further enlighten
me?
> >
> > IP = "10.0.0.11"
> > sMessage = "hello world"
> > Set objShell = WScript.CreateObject("WScript.Shell")
> > objShell.Run("%comspec% /c net send " & IP & """" & sMessage & """"), 0
> > objShell.Run("net send" & IP & """" & sMessage & """"), 0
> > WScript.Echo IP
> > WScript.Echo sMessage
> >
> >
> > Thanks
> > Frank
> >
> > "Joe Fawcett" <joefawcett(a)hotmail.com> wrote in message
> > news:ufupm5DDFHA.4072(a)TK2MSFTNGP10.phx.gbl...
> >> "Frank" <signup0702(a)sina.com> wrote in message
> >> news:eNbQwnCDFHA.2568(a)TK2MSFTNGP10.phx.gbl...
> >> Hi,
> >>
> >> I have the following 2 ways to send a message to specified IP address.
> >> However, how can I modified it so that I can pass ip address and
message
> > as
> >> variable to the wshShell.run method?
> >>
> >> Set objShell = WScript.CreateObject("WScript.Shell")
> >> objShell.Run("%comspec% /k net send 10.0.0.11 ""Messages to be
send"""),
> >> 0
> >> objShell.Run("net send 10.0.0.11 Disk Space Checked, please see the log
> >> file"), 0
> >>
> >> Thanks
> >> Frank
> >>
> >> Dim IP
> >> Dim sMessage
> >> IP = InputBox ("Enter the target IP address:", "Net Send Utility",
> >> "127.0.0.1")
> >> sMessage = InputBox("Enter the message to send:", "Net Send Utility",
> >> "Hello, World")
> >> Set objShell = WScript.CreateObject("WScript.Shell")
> >> objShell.Run("%comspec% /k net send " & IP & """" & sMessage & """"), 0
> >>
> >> You may want to check returns from InputBox to see if user hsa
cancelled,
> >> use IsEmpty(IP) or IsEmpty(sMessage).
> >>
> >> --
> >>
> >> Joe (MVP)
> >>
> >>
> >>
> >
> >
>
>


 | 
Pages: 1
Next: GetDetailsOf