Reputation: 11
Please try to help me.. How to open and write commands in Command Prompt using asp.net3.5,C#.net...
if i click a Button in my UI it should open the commaond Prompt and i want excute few commands there...
Thank you..
Upvotes: 1
Views: 6790
Reputation: 86729
It sounds like you want to open the command prompt from a browsers on the client PC.
To do this you either need to:
I.e. you can't expect a normal user to allow this to happen - this is only really going to be useful on your own PC.
If this is OK then you can find an example of running an application from JavaScript using the WScript.Shell object here (this is the easiest of the two options).
Upvotes: 1
Reputation: 4114
Try to use this code you need to add the namespace
using System.Diagnostics;
var processStartInfo = new ProcessStartInfo
{
Arguments = "ping google.com",
FileName = "cmd"
};
Process process = Process.Start(processStartInfo);
Upvotes: 2
Reputation: 18430
You said
if i click a Button in my UI
so do you mean on the client side from browser.. sorry that's not possible from any JavaScript Code. You can't start a process on clients system with any code running in Browser. Something should be installed as a Desktop app to do that.
Upvotes: 0