Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In dos, is there a way to merge a set of files so that for instance








a 1
b 2
c 3

Just like the paste command on *nix systems

share|improve this question
dos as in "dos - operating system" or as in "windows cmd.exe" ? – akira Jul 1 '10 at 13:26
cygwin works for me – XIMRX Aug 4 '14 at 9:57
up vote 1 down vote accepted

Nope, you'll need to merge the lines with a program, or a scripting language, like Python.

Update: Look at these Win ports of GNU utilities, it includes paste (.exe)

share|improve this answer
Too bad. Sukcs not to have Linux at work... :p – Paul Jul 1 '10 at 13:40
@Paul: install – akira Jul 1 '10 at 14:21

If the data reasonably simple, you could do it with Excel. Or you could download OpenOffice and do it in Calc, but the method in Calc is a pain. (You need to paste the data into two columns then merge them with the "Concatenate" function, in formula form (e.g. concatenate(Row1; row2;))

share|improve this answer

Definitely agree that a port of Unix tools or a scripting language is the way to go (although VBScript or Powershell are probably more convenient choices than Python for Windows users), but merging two files IS possible in DOS:-


REM .bat to merge 1.txt and 2.txt

GOTO :Main

    SET /P _a=<%1
    SET /P _b=<%2

    ECHO %_a% %_b%

    DEL %1 %2

    GOTO :EndMerge

    SET _LinesIn1=
    SET _LinesIn2=

    SET _a=
    SET _b=


    SET _LinesIn1=0
    SET _LinesIn2=0

    FOR /F "delims=: tokens=1,*" %%i IN ('findstr /n "^" 1.txt') DO (
        SET /A _LinesIn1+=1

    FOR /F "delims=: tokens=1,*" %%i IN ('findstr /n "^" 2.txt') DO (
        SET /A _LinesIn2+=1

    IF %_LinesIn1% NEQ %_LinesIn2% (
        ECHO Cannot merge files; mismatched line count:-
        ECHO   1.txt - %_LinesIn1% lines
        ECHO   2.txt - %_LinesIn2% lines

        DEL _c*

        GOTO :CleanUp

    FOR /L %%n IN (1, 1, %_LinesIn1%) DO (
        CALL :StartMerge _c1n%%n _c2n%%n

        REM No-op to avoid ") was unexpected at this time." error

    GOTO :CleanUp

File under "Just because you can, doesn't mean you should." :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.