in reply to open(TO, "|-") is a bad file name?

The only time you can pipe in Windows (that i know of) is during programme invocation on the command line or in batch.