How to? Pass output from ffind to another command in a BTM file

Feb 23, 2012
240
3
Hi,
I'd like to run ffind in a BTM file in order to retrieve a specific line from a text file, and then I'd like to pass that line to another command. (Specifically, the text file contains a list of filenames and paths; ffind will extract the relevant line, based upon the input parameter to the BTM file, and then I'd like to pass that path+filename to the copy command, to copy the specified file to another location).
Does anyone have any sample BTM code that would demonstrate how to accomplish this task?
 
Feb 23, 2012
240
3
Ah, I think I see now. The help file explains that I can use @CON: in order to direct piped output to a specific place on the command line. So, I can just write:
ffind /k /m /t%1 filepaths.txt | copy @CON: c:\destination
This does the trick.

Hi,
I'd like to run ffind in a BTM file in order to retrieve a specific line from a text file, and then I'd like to pass that line to another command. (Specifically, the text file contains a list of filenames and paths; ffind will extract the relevant line, based upon the input parameter to the BTM file, and then I'd like to pass that path+filename to the copy command, to copy the specified file to another location).
Does anyone have any sample BTM code that would demonstrate how to accomplish this task?
 
May 20, 2008
11,400
99
Syracuse, NY, USA
Hi,
I'd like to run ffind in a BTM file in order to retrieve a specific line from a text file, and then I'd like to pass that line to another command. (Specifically, the text file contains a list of filenames and paths; ffind will extract the relevant line, based upon the input parameter to the BTM file, and then I'd like to pass that path+filename to the copy command, to copy the specified file to another location).
Does anyone have any sample BTM code that would demonstrate how to accomplish this task?
How about @EXECSTR[]?

Code:
COPY %@EXECSTR[FFIND /K /M /T%1 filepaths.txt] c:\destination
 
May 20, 2008
11,400
99
Syracuse, NY, USA
That's a more elegant approach, provided you only want the first line.
It sounded like Avi wanted only one line. For more (or one, I suppose), DO might work.

Code:
DO file IN /P FFIND /K /M /T%1 filepaths.txt
COPY %file c:\destination
ENDDO
 
Similar threads
Thread starter Title Forum Replies Date
D Can alias pass parameters to for command? Support 3
vefatica PSHELL: How pass arguments to script? Support 15
M Backquoted parameters used in GoSub don't pass string as a single parameter Support 2
D How to? Pass OpenHere Folder to CMD? Support 6
A Unable to pass batch file arguments unaltered Support 18
samintz How to? Pass a structure to @WINAPI Support 1
Mordachai How to pass URL to sendmail? Support 10
J How to pass a character like " " to a function Support 3
Emilio III Control characters pass through? Support 6
A How to? TEE - duplicate output to STDERR Support 3
FreezerBurnt ANSI Prompt messes up list output. Support 39
Ó Recent git output not shown on TCC Support 1
Peter Murschall TEE cannot handle Unicode output Support 2
C TEE command appending null characters to output Support 6
Jesse Heines webform output different in ver. 26 than ver. 25 Support 2
vefatica Piping the output of a DO loop. Support 4
vefatica TCMD output invisible on Win10 Support 22
B How can TCC make an output as a part of command string Support 2
Enigma Take Command 23 duplicates output Support 0
Joe Caverly Works with CMD.EXE, no output with TCC.EXE Support 7
S Output from debugger Support 4
M TCC incorrect dir output since Windows 1803 Support 6
A WAD Output redirection to IF block fails with "unbalanced brackets" Support 7
P Scrollable colored output Support 3
scottb How to? ipconfig output in current window Support 4
David McClelland TEE command puts it's output file in c:\ Support 4
vefatica How to? TPIPE ... see output right away? Support 4
T Fixed Unnecessary debug output Support 3
JohnQSmith Weird DIR output (missing lines) Support 1
J WAD Output redirection in tcexit looses data Support 31
vefatica Console output slower that before Support 8
Mordachai How to capture all console output from a TCMD session? Support 4
C Output continues after Ctrl-Break Support 8
Steve Pitts WAD Strange output from DEL of a non-existent directory Support 7
I perl output is not visible Support 4
I v16 - cls corrupts output stream Support 7
D Fixed Minor problem: output not alligned in the tree command Support 1
vefatica WAD IDE, output window to foreground Support 3
R WAD Strange output from "memory" command Support 1
A How to? Set up a log file for all command output Support 3
A How to? Use TEE with .NET output Support 6
T How to? Logging Output from External Programs Support 4
Frank output of @ipaddress/@ipname Support 1
dcantor Unidentifiable output Support 16
Stefano Piccardi forum software writes debugging output Support 5
Stefano Piccardi TCC 13 vs. TCC 14 different FFIND /E"d$" output Support 1
H TPIPE: /FILTER and /OUTPUT unexpected incompatibility Support 6
Stefano Piccardi issue: redirecting GOSUB output Support 11
J Can you redirect output to printer device with echo? Support 1
A How to? How to enable UTF-8 output in tcmd.ini Support 9

Similar threads