How do I write the following lines of code in C#?

How do I write the following lines of code in C#?

How do I write the following lines of code in C#?
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run("cmd.exe")

    Requires Free Membership to View

    When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchWinDevelopment.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchWinDevelopment.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

If you are simply interested in launching applications using C#, look into the Process.Start() method in the Diagnostics namespace. I am not able to determine the scope of your application by the question presented, but I get the feeling you are trying to do this from a web page. If you are trying to launch programs from a web page then you could either continue to use scripting (VBScript, JScript, or WScript) to implement the desired actions. Or you could write an ActiveX object (COM) or .NET object that could be embedded in a page and downloaded to the client and run locally. You need to be carefull when running programs on the client side of the security settings in place on the client. Local internet security settings may be cranked up to deny such requests.

If this is a windows application (client and server) then you could use Sockets to create a simple client and server protocol that would allow you to send commands back and forth and execute any processing you need to launch programs or open files. This of course would be a much more complicated scenario requiring more developement time and research.

Feel free to contact me with more details reqarding your specific problem, using this link.

This was first published in September 2004