Combine common functionality, fix for Windows

 - Combine common functionality in `_run_command` function.
 - Fix Windows support, where `pip.parseopts(...)` only returns a tuple
   of two elements, as opposed to four.