Solved

Executing Commands

Posted on 2004-09-26
2
202 Views
Last Modified: 2010-05-05
Good evening, all,

From a C# "Windows Application", how do I execute system command on "button1_click"?  For example, the "net send" command.  If I wanted to send a message across the LAN to SysAdmin from Console I'd just type "net send SysAdmin message".  I want to translate that to C#...  I hope I make sense LOL.  Thanks in advance!

Regards,
Tony
0
Comment
Question by:fattumsdad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
eternal_21 earned 500 total points
ID: 12156772
Use this:

  System.Diagnostics.Process process = new System.Diagnostics.Process();
  process.StartInfo.FileName = "cmd";
  process.StartInfo.UseShellExecute = false;
  process.StartInfo.Arguments = "/c net send * Hello World!";
  process.Start();

Obviously, replace the "net send * Hello World!" with whatever command line executable you would be running.
0
 
LVL 1

Author Comment

by:fattumsdad
ID: 12156785
Eternal,

As always, thanks for your help!!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question