Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2417
  • Last Modified:

Using "Net send command"

halo there,.....

currently i've been using the winXp "Net Send" command to send the message to other Pc over the local network.
i have incorporate the dos-command into my program. but i discover that there seem no way to let my program get the feedback from the command whether the message have successfully send to the destination.
is there anyway to let the program know that the message have successfully sent or not...

my program looks like this


shell(net send ksboyz halo )

i am using the shell function to run the command line....

from
ksboyz
0
ksboyz
Asked:
ksboyz
  • 3
  • 3
  • 2
  • +2
2 Solutions
 
J-ManCommented:
If all you want is to know if the message was sent successfully you could change your code to:

shell(net send ksboyz halo > C:\feedback.txt)

Then open and read the C:\feedback.txt file into a string.  It will look like either:
(1) The message was successfully sent to ksboyz.
or
(2) An error occurred while sending a message to ksboyz.

Then check the string for either "successfully" or "error" and you'll know if it worked or not.

Note: A failure to send may take a while to register depending on the timeout value (could be 60 - 90 seconds or more), so you will either have to wait a specified amount of time before checking the feedback.txt file or monitor your shell command to know when it terminates.
0
 
ksboyzAuthor Commented:
halo..... J-man ....i've tried to run it but it seem doesn't work....though if it's in command-dos prompt mode, by simple typing out the statement...it works...

but unfortunately, i try to write it on the program but it shown all the statement(including >c:\feedback.txt) instead of saving feedback to feedback.txt

i=Shell("net send ksboyz haha > C:\feedback.txt", vbHide)
: (


from
ksboyz
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
J-ManCommented:
Oh yeah, I forgot about that "feature".  ;-)
We should use a batch file instead...  try this:

1) Create a text file called "mysend.bat" (without quotes) in the c:\ folder.  You may want to do this (and step 2) with your program if you intend to distribute it, or install the bat file with your setup program.

2) In the mysend.bat file type in the following text and save the file:

net send %* > c:\feedback.txt

3) Change the VB code to:

Dim myStr as String
myStr = "c:\mysend.bat" & " " & "Computername" & " " & "The message text"
'for your example, you would put in "ksboyz" for "computername", and "halo" for "the message text"
i=Shell(mystr, vbhide)
'wait a few seconds
'check c:\feedback.txt file
0
 
CleanupPingCommented:
ksboyz:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
hongjunCommented:
split b/w J-Man(Accepted) and hongjun
0
 
J-ManCommented:
I agree with hongjun.
Split the points.
0
 
CleanupPingCommented:
ksboyz:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
hongjunCommented:
split b/w J-Man(Accepted) and hongjun
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Split points between: hongjun and J-Man

DanRollins -- EE database cleanup volunteer
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now