I tried this script that set the contents of the filename as variable "a" and then fed this variable "a" as an argument to the "p" program.
@echo off
for /f "tokens=1 delims={" %%a in ('TYPE filename ^| FINDstr /r "[a-z]"') do (cmd /c p "%%a")
pause
Note that this script has a number of limitations as I used regular expression in findstr command supposing that the contents of filename is just text.
I don't know what your filename contents are so you have to modify it to suites your needs.
Also you need to modify your program "p" so that it accepts arguments.
Hope this help.
p < myfileis not working, it probably is not a problem of the redirection. Try something likesort < myfileand see what happens. – bjanssen May 12 '14 at 20:16type filename | P– Kevin Fegan May 12 '14 at 21:18P < filenameis now working. Sounds like you no longer have a problem. – Kevin Fegan May 12 '14 at 21:30typeseems to sometimes "eat" newlines in the input (if the newline is on an internal buffer boundary, I suspect -- rather nasty to get42where4\n2is in the file); the approach with<(https://stackoverflow.com/a/15991395/110118) seems to work nice though – mlvljr Aug 14 '19 at 20:42