Reputation: 3749
I'm trying to pipe Windows commands into a program that essentially runs a console and I'm a newbie at this so I'm not quite getting the command right. What I want to do is pipe the command dir /b > out.txt into that other program.
The command is
echo dir /b > out.txt | nc.exe 127.0.0.1 7003 - ignore the nc.exe its not important
What I want is to pipe the output of echo which should be "dir /b > out.txt" but I'm getting the order of operations or something wrong. Currently what happens is that I write "dir /b" into the file out.txt and pipe nothing into nc.exe.
Upvotes: 0
Views: 658
Reputation: 19315
double quote or escape >
echo "dir /b > out.txt" | nc.exe 127.0.0.1 7003
or
echo dir /b ^> out.txt | nc.exe 127.0.0.1 7003
Upvotes: 2
Reputation: 3474
Not sure if its good enough for you.
echo stackoverflow.com > out.txt
nslookup<out.txt
Take a gander at http://www.robvanderwoude.com/redirection.php
Upvotes: 0