Running shell commands in ASP.NET

2019-05-11 23:13发布

问题:

How do i run a shell command in asp.net ?

I basically want something like system("netstat -an");

I don't want the output to be displayed to the user. Just want to run some maintenance commands.

回答1:

call System.Diagnostics.Process.Start("netstat", "-an"); as usually



回答2:

Use Process.Start:

Process.Start("netstat", "-an");