-
Notifications
You must be signed in to change notification settings - Fork 29
/
Processing.ps1
43 lines (36 loc) · 1.34 KB
/
Processing.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Handling processes in powershell
#
Function f1()
{
Write-Host "1: $MyInvocation.ScriptName"
sleep 1
}
Function f2()
{
Write-Host "2: $MyInvocation.ScriptName"
sleep 2
}
Function f3()
{
Write-Host "3: $MyInvocation.ScriptName"
sleep 3
}
<#
Debug-Process Debugs one or more processes running on the local computer.
Get-Process Gets the processes that are running on the local computer or a remote computer
Start-Process Starts one or more processes on the local computer.
Stop-Process Stops one or more running processes.
Wait-Process Waits for the processes to be stopped before accepting more input.
#>
$process1 = Start-Process find.exe # no ("external" defined) functions?
$process2 = Start-Process sort.exe # no return of an object!
$process3 = Start-Process mem.exe # so no returned id or whatever else!
#$process1 = Start-Process { Write-Host "1: $MyInvocation.ScriptName" } # no output from a Process?
#$process2 = Start-Process { Write-Host "2: $MyInvocation.ScriptName" }
#$process3 = Start-Process { Write-Host "3: $MyInvocation.ScriptName" }
Wait-Process $process1.Id
Wait-Process $process2.Id
Wait-Process $process3.Id
Stop-Process $process1.Id
Stop-Process $process2.Id
Stop-Process $process3.Id