4

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.

Amicable
  • 3,115
  • 3
  • 49
  • 77
demos
  • 2,630
  • 11
  • 35
  • 51

2 Answers2

7

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

abatishchev
  • 98,240
  • 88
  • 296
  • 433
3

Use Process.Start:

Process.Start("netstat", "-an");
Oded
  • 489,969
  • 99
  • 883
  • 1,009