CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2000
    Posts
    110

    using the command prompt in c#

    Hi,

    In C++ there is a function called System(...) that you can call to run a command from a dos prompt while running your application. Is there a similar function in C#?

    Thanks

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: using the command prompt in c#

    Quote Originally Posted by mps2
    Hi,

    In C++ there is a function called System(...) that you can call to run a command from a dos prompt while running your application. Is there a similar function in C#?

    Thanks
    What do you want to do. There are multiple ways, if you just want to write something to the console then you can use Console Class or if you want to start a new command prmpt, you can use Process class.

  3. #3
    Join Date
    Aug 2000
    Posts
    110

    Re: using the command prompt in c#

    I want to call an exe and pass it a string as command line args

  4. #4
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: using the command prompt in c#

    Quote Originally Posted by mps2
    I want to call an exe and pass it a string as command line args
    An easy way would be to use Process Class.
    Code:
    System.Diagnostics.Process.Start("Path&NameOfEXEfile", ParameterToBePassed);
    Remember you will have to pass the complete path of the exe file and the second parameter is the commandline parameter that you want to pass.

  5. #5
    Join Date
    Aug 2000
    Posts
    110

    Re: using the command prompt in c#

    It works! Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured