Thread: Running Command Prompt Functions

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    1

    Running Command Prompt Functions

    Hi,

    I am a week old in C#, so please excuse my ignorance.

    How do I run a dos cmd with C#?

    IE: net use / ping / ipconfig etc etc etc...

    I learnt how to run the cmd.exe file but I don;t know how to do the things inside the command promt?

    Any advice?

    I want it to run on start up, Instead of a simple hit of a button, I know how to do it with MessageBox

    static void Main()

    {
    {
    MessageBox.Show("Test",
    "Test");

    }
    {
    Application.Run(new Form1());
    }
    }

    Any help would be greatly helpful
    Last edited by dragonhawk; 09-26-2006 at 07:21 AM.

  2. #2
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    First of all use code tags.

    Second, all the commands you can use are located in c\windows\system32\

    And I end with the one liner:

    Code:
    System.Diagnostics.Process.Start(@"c:\windows\system32\commandToBeExecuted");
    More info can be found here.

    btw:

    Code:
    static void Main() {
    
     MessageBox.Show("Test","Test");
    
     Application.Run(new Form1());
    
    }
    It didnt make any sense, nor does it not , but I hope you can see the benefits of the code tags .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Running 2 functions simultaneously
    By blkhockeypro19 in forum C Programming
    Replies: 7
    Last Post: 04-19-2009, 12:48 AM
  2. An array of macro functions?
    By someprogr in forum C Programming
    Replies: 6
    Last Post: 01-28-2009, 07:05 PM
  3. Running Normal Functions inside of a class
    By Padawan in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2004, 11:52 PM
  4. Expression Manipulator v0.2 (bug fixes, functions)
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-26-2003, 04:52 PM
  5. trouble defining member functions
    By dP munky in forum C++ Programming
    Replies: 7
    Last Post: 04-13-2003, 08:52 PM