I have a very simple Powershell v1.0 script to kill processes by name:
$target = $args[0]
get-process | where {$_.ProcessName -eq $target} | stop-process -Force
which works. However, when I just had
get-process | where {$_.ProcessName -eq $args[0]} | stop-process -Force
it wouldn't find any processes. So why does the argument need to be copied into a local variable for the code to work?