?
Solved

Executing Commands

Posted on 2004-09-26
2
Medium Priority
?
207 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 2000 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

764 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