You'll need to use codepage 65001
@echo off
CD /d "%~dp0"
CHCP 65001 > nul
Setlocal EnableExtensions DisableDelayedExpansion
for /f "delims= " %%T in ('robocopy /L . . /njh /njs' )do set "TAB=%%T"
set "f1=%~dp01.txt"
set "f2=%~dp02.txt"
set "outfile=%~dp0mix.txt"
break>"%outfile%"
<"%f2%" (
for /f "usebackq delims=" %%a in ("%f1%") do (
set /p "right="
set^ "left=%%a"
setlocal enabledelayedexpansion
>>"%outfile%" (echo(!left!!TAB!!right!)
endlocal
))
type "%outfile%"
Pause
Output:
Agenda Διάταξη των εργασιών
Edit
Batch / powershell solution to handle lines up to 8191 bytes
@echo off
CD /d "%~dp0"
CHCP 65001 > nul
set "f1=%~dp01.txt"
set "f2=%~dp02.txt"
set "outfile=%~dp0mix.txt"
break>"%outfile%"
>"%Outfile%" (
powershell -noprofile -command ^
"$File1 = @(Get-Content "%f1%" -Encoding utf8); $File2 = @(Get-Content "%f2%" -Encoding utf8);$Max = [math]::Max($File1.GetUpperBound(0), $File2.GetUpperBound(0)); for($i = 0; $i -le $Max; $i++) {write-host ($File1[$i],$File2[$i]) -Separator "`t"}"
)
type "%outfile%" > Con
Pause
goto:Eof
Note - the above does not qualify that both files have an equal number of lines, nor does it alter the action taken if one string is empty and the other is not - These are considerations not discussed in your question, and as such will not be adressed in this answer - Note, you should consider doing so if you anticipate an unequal number of lines may be encountered if there is any need to prevent such lines being prepended or appended with the seperator character.
A breakdown:
- Load the files into arrays, specifying utf8 encoding:
$File1 = @(Get-Content "%f1%" -Encoding utf8)
$File2 = @(Get-Content "%f2%" -Encoding utf8)
- Get the maximum number of lines:
$Max = [math]::Max($File1.GetUpperBound(0), $File2.GetUpperBound(0))
- For each array index from 0 to Maximum
- write lines at current index specifying separator:
for($i = 0; $i -le $Max; $i++) {
write-host ($File1[$i],$File2[$i]) -Separator "`t"
}
Lastly, the same as a powershell .ps1 script:
CHCP 65001 | Out-null
$F1 = (resolve-path -path $PSScriptRoot\1.txt).Path
$F2 = (resolve-path -path $PSScriptRoot\2.txt).Path
$Outfile = "$PSScriptRoot\mix.txt"
$File1 = @(Get-Content "$F1" -Encoding utf8)
$File2 = @(Get-Content "$F2" -Encoding utf8)
$Max = [math]::Max($File1.GetUpperBound(0), $File2.GetUpperBound(0))
$(for($i = 0; $i -le $Max; $i++) {
$line = ($File1[$i],$File2[$i]) -join "`t"
Write-Output $Line
}) | Out-File $Outfile -encoding utf8
Type $Outfile