Add code to make autoswap work on Windows.

Some changes to attempt to make this work on Windows using +clientserver.  Not perfect, but works.