$processes[$in-1].Start()will not work. You need to capture processinfo when you kill, and run the same application again. You can get binary process information and command line information using the WMI Win32_Process class.
For instance,
Clear-host
$processes = Get-Process notepad
$processes.Count
if($processes.Count -gt 1)
{
$i = 0
Write-host "There are multiple processes for notepad."
foreach($process in $processes)
{
$i++
$i.ToString() + '. ' + $process.MainWindowTitle
}
$in = Read-host "Give a number of the process to kill: "
write-host
write-host "killing and restarting: " + $processes[$in-1].MainWindowTitle
$procID = $processes[$in-1].Id
$cmdline = (Get-WMIObject Win32_Process -Filter "Handle=$procID").CommandLine
$processes[$in-1].Kill()
$processes[$in-1].WaitForExit()
}
WMI . , "C:\WINDOWS\system32\NOTEPAD.EXE" C:\Users\ravikanth_chaganti\Desktop\debug.log
, , - - ( , ). :
Start-Process -FilePath $cmdline.Split(' ')[0] -ArgumentList $cmdline.Split(' ')[1]
.
, . PowerShell . .