I'm trying to create a loop that, line by line, compares 2 files, sending the difference to a 3rd
Code: Select all
FOR /F %%G IN (ALPHA.TXT) DO TYPE BETA.TXT | FIND /I /V "%%G">GAMMA.TXT
Can it be done this way?
Moderator: DosItHelp
Code: Select all
FOR /F %%G IN (ALPHA.TXT) DO TYPE BETA.TXT | FIND /I /V "%%G">GAMMA.TXT
Code: Select all
@echo off
set "file1=list1.txt"
set "file2=list2.txt"
set "finalfile=all.txt"
set "separator=:"
(
For /F "delims=" %%a in (%file1%) Do (
Setlocal EnableDelayedExpansion
Set /p line=
Echo.%%a!separator!!line!
Endlocal
)
)<%file2%>>%finalfile%
For /F "tokens=1-2 delims=:" %%A in (all.txt) Do (
IF not "%%A" == "%%B" Echo %%B>diff.txt
)
pause
line1:line1
line2:line2
FOR /F %%G IN (ALPHA.TXT) DO TYPE BETA.TXT | FIND /I "%%G">>GAMMA.TXT
Code: Select all
@echo off
set "file1=%~1"
set "file2=%~2"
del "result.compare.txt" 2>nul
set c=0
setlocal enabledelayedexpansion
<%file2% (for /f "delims=" %%a in ('type "%file1%"') do (
set /a c=c+1
set b=
set /p b=
if not "%%a"=="!b!" (
echo line !c! has a mismatch
>> "result.compare.txt" echo %file1% line !c!: %%a
>> "result.compare.txt" echo %file2% line !c!: !b!
)
)
)
if exist "result.compare.txt" (
echo check "result.compare.txt" for mismatches
) else (
echo no mismatches found
)
pause
if exist in Output.txt goto start, else echo to Output.txt, goto start
Code: Select all
(
For /F "delims=" %%a in (file1.txt) Do (
Setlocal EnableDelayedExpansion
Set /p line=
if "%%a" NEQ "!line!" Echo !line!
Endlocal
)
)<"file2.txt"
That's a different task altogether.
It helps enormously to describe what you actually need to do from the outset.
What command line are you using with tasklist? Do you only want the program name?
I want to specify a directory of allowed .exe's (My USB)
Couple that with the currently running .exe's /windows stuff (Maybe even a 'Fresh Install Tasklist-List')
And ban all other .exe's
Boombox wrote:.
@Foxi, Sorry mate I thought I was clear yesterday...
Although you advised against it, ('You'll break things') I'm attempting to stop all new process' on a system..