Home All Groups Group Topic Archive Search About


Author
16 Nov 2007 11:57 PM
ned
Hi all

I am not sure this is OT

Is there a way to concatenate the output from two commands into a single
line in a batch file?


Something like

echo A <concatenate> echo B >> file.txt

that would create one line

AB

instead of two lines

A
B

in file.txt?

Thanks

BTW I could not find a dos-shell NG... obsolete? :-)

Author
17 Nov 2007 1:32 AM
Tom Lavedas
On Nov 16, 6:57 pm, ned <n...@nospam.com> wrote:
Show quote
> Hi all
>
> I am not sure this is OT
>
> Is there a way to concatenate the output from two commands into a single
> line in a batch file?
>
> Something like
>
> echo A <concatenate> echo B >> file.txt
>
> that would create one line
>
> AB
>
> instead of two lines
>
> A
> B
>
> in file.txt?
>
> Thanks
>
> BTW I could not find a dos-shell NG... obsolete? :-)

There is no easy way to concatenate lines in batch - though it can be
done, just not easily.

One place to get help with this is alt.msdos.batch/nt

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
Author
19 Nov 2007 1:38 PM
J Ford
There are some Unix Utils for Win32 here:
http://unxutils.sourceforge.net/

In the UnxUpdates.zip there is a cat.exe that will concatenate STD IN/OUT or
files for you.

Show quote
"Tom Lavedas" wrote:

> On Nov 16, 6:57 pm, ned <n...@nospam.com> wrote:
> > Hi all
> >
> > I am not sure this is OT
> >
> > Is there a way to concatenate the output from two commands into a single
> > line in a batch file?
> >
> > Something like
> >
> > echo A <concatenate> echo B >> file.txt
> >
> > that would create one line
> >
> > AB
> >
> > instead of two lines
> >
> > A
> > B
> >
> > in file.txt?
> >
> > Thanks
> >
> > BTW I could not find a dos-shell NG... obsolete? :-)
>
> There is no easy way to concatenate lines in batch - though it can be
> done, just not easily.
>
> One place to get help with this is alt.msdos.batch/nt
>
> Tom Lavedas
> ===========
> http://members.cox.net/tglbatch/wsh/
>
Author
20 Nov 2007 10:48 PM
Jeffery Hicks [MVP]
Are you really needing to get things done on one line, or do you need to
save output from two different commands to the same file?

DIR %temp% > file.txt
Ping localhost >> file.txt

Maybe a bit more background on the actual commands you're trying to work
with will help.

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.
Show quote
"Tom Lavedas" <tglba***@cox.net> wrote in message
news:1a6152aa-78ba-40aa-b133-6fc6615f5f4f@a28g2000hsc.googlegroups.com...
> On Nov 16, 6:57 pm, ned <n...@nospam.com> wrote:
>> Hi all
>>
>> I am not sure this is OT
>>
>> Is there a way to concatenate the output from two commands into a single
>> line in a batch file?
>>
>> Something like
>>
>> echo A <concatenate> echo B >> file.txt
>>
>> that would create one line
>>
>> AB
>>
>> instead of two lines
>>
>> A
>> B
>>
>> in file.txt?
>>
>> Thanks
>>
>> BTW I could not find a dos-shell NG... obsolete? :-)
>
> There is no easy way to concatenate lines in batch - though it can be
> done, just not easily.
>
> One place to get help with this is alt.msdos.batch/nt
>
> Tom Lavedas
> ===========
> http://members.cox.net/tglbatch/wsh/

AddThis Social Bookmark Button