You could extract a method here, which would be easy to test.

    IConsole GetConsole(bool isWindows, bool? useUnixLikeConsoleVariable)
    {
    }

You'd have to invent a new `IConsole` interface with `Write` and `ReadLine` methods on it.