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
Solved

Executing Commands

Posted on 2004-09-26
2
201 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
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
2 questions 10 29
Call Controller Action Method from ASPX 2 22
VB.NET 2008 - SQL Timeout 9 34
How to Generate a Method from a keyboard shortcut in Visual Studio? 2 19
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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