Q
Problem solve Get help with specific problems with your technologies, process and projects.

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")

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.

Dig Deeper on C# programming language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

Close