• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Making a Windows Batch File

tatteredpotato

Diamond Member
I have 49 text files named:
results1.txt
results2.text
....
....
results50.txt

There is every file in between except results13.txt.

Pretty much I want to make a script that will make a new file that will just put the files together. I've found the "COPY" command should do this, however I'm running into some issues. First I assumed that the shell would run from the directory of the batch file, however that doesn't seem to be the case. My code looks something like this (I'll update when I get to work and have the actual code).

set number=1
set ext=.txt
set baseName=results
set outputFile=output.txt


:Loop
IF %number%==51 GOTO End
set currentFile=%baseName%%number%%ext%
IF EXISTS currentFile COPY outputFile+currentFile outputFile
set /a number=%number%+1

:End
pause



I did add the absolute path to the files useing something like "%~d0" as well. Is that the way I'm supposed to concatenate strings? Just %var1%%var2%....etc?

 
Originally posted by: reefcrazed
I do this all the time. You really just do a
copy resu*.txt output.txt

Oh wow I was over-complicating that wasn't I? Thanks for the help, it seems to have worked like a charm!
 
Back
Top