|
Michael,
commandfileb.cmd wants the contents of filea.txt as a parameter, like to
use
it as %1 in commandfileb.cmd. I thought I tried the commandfileb.cmd <
filea.txt technique and it didn't work...
It won't work either, if commandfileb.cmd wants the *contents* of the file
as a parameter. Like your pipe method, it would still require
commandfileb.cmd to accept the data via stdin instead of a parm.
I take it you have no control over modifying commandfileb.cmd to either use
stdin, or read a file named as an argument? What is invoking this whole
process? Can you change it to read filea.txt and create the command string
to get executed?
If not, you might be able to do something like this::
Set /p data= < filea.txt
commandfileb.cmd %data%
The SET command with /p tells it to set the contents of environment
variable
data from prompted input. Then we don't name a prompt string, and use <
filea.txt to redirect stdin to supply the value to the SET command. Then
you can use %data% in subsequent commands to act as a parm.
But will filea.txt always contain a single line of data? Will it have
embedded blanks? If there are embedded blanks you may need:
Set /p data= < filea.txt
commandfileb.cmd "%data%"
If there can be more than one line of data in filea.txt, you really should
have commandfileb.cmd able to read the file directly or accept input via
stdin so you can pipe data into it. It still isn't clear to me what
commandfileb.cmd should be doing or why it can't read filea.txt itself.
Doug
--
This is the PC Technical Discussion for iSeries Users (PcTech) mailing list
To post a message email: PcTech@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/pctech
or email: PcTech-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/pctech.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.