2010年7月28日 星期三

Start And Kill process

Process Class


Provides access to local and remote processes and enables you to start and stop local system processes.

Sample Code

1. Start notepad
System.Diagnostics.Process.Start("notepad")

2. Start winword
System.Diagnostics.Process.Start("WINWORD")

3. Start excel
System.Diagnostics.Process.Start("Excel")

4. Start ie and parameter
System.Diagnostics.Process.Start("IExplore.exe", "http://vbnetsample.blogspot.com/")

5. Kill It!!
' Kill all notepad process
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("notepad")

For Each p As Process In pProcess
p.Kill()
Next

沒有留言:

張貼留言