WAD Redirecting with HEAD & TAIL

Sep 11, 2009
35
0
Portland, Or.
#1
Example of what works
DIR /B | HEAD /N10 | TAIL /N1 -- this will display the 10th item, subdirectory or file

Example of what doesn't work
DIR /B | HEAD /N10 > tempfile -- this will NOT write the first 10 items to 'tempfile'

What I'm seeing is the ability of 'HEAD' to pipe it's output to another program, i.e. 'TAIL'.
But unlike 'DIR', 'HEAD' will NOT redirect to a file. It appears to work as nothing is written
to the screen.

Is this a bug or WAD?
I have Version 11
,,,, a bit later...
I found the redirected files - created in the root?? I was 2 directories down from the root! .. So I guess I have to be more explict in where I want the redirected file !!?
 
Feb 26, 2013
100
0
#2
Example of what works
DIR /B | HEAD /N10 | TAIL /N1 -- this will display the 10th item, subdirectory or file

Example of what doesn't work
DIR /B | HEAD /N10 > tempfile -- this will NOT write the first 10 items to 'tempfile'

What I'm seeing is the ability of 'HEAD' to pipe it's output to another program, i.e. 'TAIL'.
But unlike 'DIR', 'HEAD' will NOT redirect to a file. It appears to work as nothing is written
to the screen.

Is this a bug or WAD?
I have Version 11
,,,, a bit later...
I found the redirected files - created in the root?? I was 2 directories down from the root! .. So I guess I have to be more explict in where I want the redirected file !!?
I suspect that it's to do with the pipe Bob. When you create a pipe another instance of TCC is started to receive the command output that you are piping to it. That TCC will run your TCSTART file, and if that puts you in the root directory then that's where your redirected files will end up.

You might need to ensure that only the essential commands are run in TCSTART by using %_pipe to identify when TCC is in a pipe.

Or, as you say, use a full path and then there should be no doubt where the files will go.


Dan
 
Sep 11, 2009
35
0
Portland, Or.
#4
Thanks folks.. In this case, it's a fixed directory - so the explicit path worked.

Having a 'current directory' variable in a CMD file would've done it elegently..