I use WinSCP with automated scripts. Winscp.exe somethings fails to close and then no more sessions of Winscp.exe can be run on the box (or at least under that user). The problem occurs intermittently. This problem has occurred with version 4.0.6 and even the 4.1.3 beta. It is not clear what happens that causes this. I have tried to create a monitor process to fix this problem, but Winscp forks or spawns and there is no way to get all of process ids.
I have noted that this problem is easy to replicate with a simple Perl script (note problem seems to occur 50% of the time this script is called. I tried /log and got no output.
O.k., so here Perl script the script file:
##script file named tt
## note this is designed to keep Winscp.exe up so it can be killed
option batch on
option batch abort
option confirm off
##Perl (ActivePerl 5.8.8) control script
$Args='/console /script=tt /log=c:\temp\foo';
print Win32::FormatMessage( Win32::GetLastError() );
Win32::Spawn( $executable, $Args, $Pid );
Win32::Process::KillProcess($Pid, $exitcode) || die ErrorReport();