Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This topic is interesting! Perhaps you, like me, find confusing and annoying the output format of FC command, although it provides the required information indeed. The Batch program below take the output of FC command and rearrange it in a way that allows to identify if a new block of information has been added between two lines of original file, or if a block of lines has been deleted from the original file, or any other case of file modification (updated). The most difficult part was to choose the format to display the information in a pleasant way, but I think my solution is pretty good!</p> <pre><code>@echo off rem FCOMP.BAT: Format FC output in a pleasant way rem Antonio Perez Ayala if "%~2" neq "" goto start echo Format FC output identifying added, deleted or updated sections echo/ echo FCOMP filename1 filename2 [/switches /for /FC /command] goto :EOF :start setlocal EnableDelayedExpansion set while=if not set do=goto endwhile set endwhile=goto while set "space= " set "spaces39= " fc %3 %4 %5 %6 %7 %8 %9 %1 %2 &gt; differences.txt if %errorlevel% equ 1 call :FormatFC &lt; differences.txt del differences.txt goto :EOF :FormatFC set /P line= set /P line= rem Process each set of differences :while %while% defined line %do% rem Load old and new sections of this set set line= set /P line= set old=0 :while1 %while% "!line:~0,5!" neq "*****" %do%1 set /A old+=1 set oldLine[%old%]=!line!%spaces39% set line= set /P line= %endwhile%1 :endwhile1 set line= set /P line= set new=0 :while2 %while% "!line:~0,5!" neq "*****" %do%2 set /A new+=1 set newLine[%new%]=!line!%space% set line= set /P line= %endwhile%2 :endwhile2 rem Identify the type of this set if %old% equ 2 ( echo ====== NEW SECTION ADDED ==================================================== echo/ echo(!oldLine[1]:~0,79! set /A new-=1 for /L %%i in (2,1,!new!) do echo( ^|!newLine[%%i]:~0,70! echo(!oldLine[2]:~0,79! ) else if %new% equ 2 ( echo OLD SECTION DELETED ========================================================== echo/ echo(---------!newLine[1]:~0,70! set /A old-=1 for /L %%i in (2,1,!old!) do echo -!oldLine[%%i]:~0,78! echo(---------!newLine[2]:~0,70! ) else ( rem both %old% and %new% gtr 2 echo ============================== SECTION UPDATED ============================== echo/ if %old% lss %new% ( for /L %%i in (1,1,%old%) do echo(!oldLine[%%i]:~0,39!^|!newLine[%%i]:~0,39! set /A old+=1 for /L %%i in (!old!,1,%new%) do echo(%spaces39%^|!newLine[%%i]:~0,39! ) else ( for /L %%i in (1,1,%new%) do echo(!oldLine[%%i]:~0,39!^|!newLine[%%i]:~0,39! set /A new+=1 for /L %%i in (!new!,1,%old%) do echo(!oldLine[%%i]:~0,39! ) ) rem Pass to next set of differences echo/ set /P line= set line= set /P line= %endwhile% :endwhile exit /B </code></pre> <p>Antonio</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload