Align text in output file
Posted: 26 May 2016 06:54
I have the following code that Foxidrive helped me with awhile ago and I want to have the output file right/left aligned. I have found 2 examples so far that seem to fit the bill but I can't figure out how to apply them to my code. Here is my code.
Here is the output currently:
I want to left justify the first column and right justify the date and time columns.
Here are the 2 code examples that I'm working with: Example1 and Example2
I just can't seem to apply either to my code.
Code: Select all
@echo off
setlocal enabledelayedexpansion
set "testing=0"
if "%testing%" EQU "1" (
set "xmlpath=F:\Scripts\batch\EOD testing"
) ELSE (
set "xmlpath=\\server1.prod.mtb.com\developer\inetpub\Ftproot\XMLs"
)
if exist "%temp%\filterEOD?.txt" del "%temp%\filterEOD?.txt"
If /i "%userdomain%" equ "DEV" (
set "dom=PROD"
set /p useris=Enter your production user name:
set /p pw=Enter your production password:
set Map1=Net use "%xmlpath%" !pw! /USER:!dom!\!useris! /PERSISTENT:NO
!Map1!&pushd "%xmlpath%"
) ELSE (
pushd "%xmlpath%"
)
dir /o:-d /a-d "%xmlpath%\*.xml" |find "/" >"%temp%\filterEOD.txt"
set "found=0"
set "files=0"
(
for /f "usebackq tokens=1,2,3,4,*" %%a in ("%temp%\filterEOD.txt") do (
set "f3=%%e"
echo %%e %%a %%b %%c
if !found! GTR 0 set /a files+=1
IF /i "!f3:~0,3!" EQU "EOD" IF !found! GTR 0 (
set /a files-=1
echo(
echo located !files! files between EOD files in total
echo(
goto :out
)
IF /i "!f3:~0,3!" EQU "EOD" set /a found+=1 && Echo( && ECHO(
)
if !found! LSS 2 (
echo( & echo(
echo Only !found! EOD file found
echo !files! files were found from the first EOD file
)
)>"%temp%\filterEOD2.txt"
:out
start "Filter EOD Files" "%temp%\filterEOD2.txt"
popd
del "%temp%\filterEOD.txt"
endlocal
exit /b
Here is the output currently:
Code: Select all
SB9116930001_ACCTV21_20160526_PCS_110_108880059V.xml 05/25/2016 06:01 PM
SB1836430001_ACCTV21_20160526_PCS_1_1088800594.xml 05/25/2016 06:01 PM
SB1836430001_BALMIS_20160526_PCS_1_1088800595.xml 05/25/2016 06:01 PM
EODMESS_20160525_1088800290.xml 05/25/2016 05:45 PM
ID1799480001_BALMIS_20160525_NAC_12_108880025S.xml 05/25/2016 05:45 PM
ID1799490001_BALMIS_20160525_NAC_12_108880025G.xml 05/25/2016 05:45 PM
ID1837390001_BALMIS_20160525_NAC_8_1088800254.xml 05/25/2016 05:45 PM
TA1911120001_BALMIS_20160525_TRC_2_108880013Z.xml 05/25/2016 05:44 PM
TA1904570001_BALMIS_20160525_TRC_2_108880013I.xml 05/25/2016 05:44 PM
ID1929030001_BALMIS_20160525_TRC_2_1088800131.xml 05/25/2016 05:44 PM
OD1933020001_BALMIS_20160525_TRC_1_108880011K.xml 05/25/2016 05:44 PM
SB1508550001_BALMIS_20160525_TRC_5_1088800113.xml 05/25/2016 05:44 PM
SB9106670001_BALMIS_20160525_TRC_13_108880008M.xml 05/25/2016 05:44 PM
SB1278560001_BALMIS_20160525_TRC_12_1088800085.xml 05/25/2016 05:44 PM
SB1277510001_BALMIS_20160525_TRC_10_108880006P.xml 05/25/2016 05:44 PM
SB9128630001_BALMIS_20160525_TRC_14_1088800068.xml 05/25/2016 05:44 PM
TA1918240001_BALMIS_20160525_TRC_1_108880005S.xml 05/25/2016 05:44 PM
EX8044800001_BALMIS_20160525_TRC_12_108880005B.xml 05/25/2016 05:43 PM
SB9109620001_BALMIS_20160525_TRC_10_108880003V.xml 05/25/2016 05:43 PM
SB9109630001_BALMIS_20160525_TRC_10_108880003E.xml 05/25/2016 05:43 PM
CI5426830001_BALMIS_20160525_DEA_2_1088799973.xml 05/25/2016 05:42 PM
CI5433480001_BALMIS_20160525_DEA_1_108879996R.xml 05/25/2016 05:42 PM
EX1895670001_BALMIS_20160525_DEA_1_108879996F.xml 05/25/2016 05:42 PM
SB1481220001_BALMIS_20160525_DEA_1_1088799964.xml 05/25/2016 05:42 PM
SB1481220001_ACCTV21_20160525_DEA_1_1088799963.xml 05/25/2016 05:42 PM
EX1920880001_BALMIS_20160525_DEA_1_108879995R.xml 05/25/2016 05:42 PM
BS1829130001_BALMIS_20160525_EXP_1_108879995E.xml 05/25/2016 05:42 PM
SB1849030001_ACCTV21_20160525_EXT_1_1088799952.xml 05/25/2016 05:42 PM
EODMESS_20160525_1088799922.xml 05/25/2016 05:42 PM
located 24 files between EOD files in total
I want to left justify the first column and right justify the date and time columns.
Here are the 2 code examples that I'm working with: Example1 and Example2
I just can't seem to apply either to my code.