Thread: Executing OS Commands via my C# Program

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    24

    Executing OS Commands via my C# Program

    Hey there


    I wanna run basic windows command in my c# program (for example- I want to run 'set' , in order to get a list of all my environment variables. or even run 'dir')

    Please help

    Thanks

    Goz
    And if you get no joy from music hall
    Remember there is always alcohol
    And If you get no joy from Gin
    Here is the abyss jump in

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    Take a look at the System.Diagnostics.Process object in your documentation:
    http://ms-help://MS.VSCC/MS.MSDNVS/c...mberstopic.htm

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Speedy's solution is fine. However, for the examples you provided there are other functions that can handle what you need. Look for Environment in your help for example.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Executing a Program With Arguments
    By HalNineThousand in forum Linux Programming
    Replies: 4
    Last Post: 04-14-2008, 10:09 AM
  3. Executing DOS commands from inside an image
    By Moony in forum C Programming
    Replies: 6
    Last Post: 03-16-2008, 12:40 PM
  4. Executing system commands cross platform
    By markucd in forum C++ Programming
    Replies: 6
    Last Post: 11-04-2005, 08:56 AM
  5. executing another program
    By Jamsan in forum C++ Programming
    Replies: 2
    Last Post: 04-26-2003, 08:22 PM