Skip to content

Instantly share code, notes, and snippets.

@paretech
Last active January 3, 2016 13:09
Show Gist options
  • Save paretech/8467603 to your computer and use it in GitHub Desktop.
Save paretech/8467603 to your computer and use it in GitHub Desktop.
:: Merge indexed text files and print the result
@ECHO OFF
SETLOCAL EnableDelayedExpansion
:: User Config
SET ina_base=part1_
SET inb_base=part2_
SET out_base=sum12_
SET ext=txt
FOR %%i IN (%ina_base%*.%ext%) DO (
SET ina_filename=%%i
SET inb_filename=!ina_filename:%ina_base%=%inb_base%!
SET out_filename=!ina_filename:%ina_base%=%out_base%!
COPY !ina_filename! + !inb_filename! !out_filename!
:: Automatically open, print (default printer) and
:: close text files.
NOTEPAD /P !out_filename!
)
:END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment