Running Command Prompt Functions

This is a discussion on Running Command Prompt Functions within the C# Programming forums, part of the General Programming Boards category; Hi, I am a week old in C#, so please excuse my ignorance. How do I run a dos cmd ...

  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 08:21 AM.

  2. #2
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    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, 01: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-10-2004, 12:52 AM
  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, 05:52 PM
  5. trouble defining member functions
    By dP munky in forum C++ Programming
    Replies: 7
    Last Post: 04-13-2003, 09:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21