Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I would like to list all .txt files or any given extention in a specified directory in flat format.
dir *.txt /b
the output would look something like:
something.txt
somethingelse.txtthen I would like to take the filenames and store them as variables.
Next the user would be presented with choices using set command so he can review files.
1. something.txt
2. somethingelse.txtthe script would promt for input
please select a file to compare:
the user selects 1 and the filename gets stored in a variable. The user then selects another number and it also gets stored into a variable.
What I am trying to do is automate a way to compare 2 files.
The user selects what 2 files he wants to compare, then the compare %variable of first file% %variable of second file% > Compare.txt
for %%f in (?) do set filename=%%f

@echo off & setLocal EnableDELAYedExpansion
set N=
for /f "tokens=* delims= " %%a in ('dir/b *.bat') do (
set /a N+=1
set v!N!=%%a
echo !N! %%a
)
echo.
set /p F=pick a file
set /p S=pick another one
fc !v%F%! !v%S%! > Compare.txt
=====================================
Helping others achieve escape felicityM2

WOOT!
Thank you soooo much. I must have flushed by batch file skills down the drain. This really made my day.
CHEERS!
Derek

![]() |
check network drive statu...
|
Split txt file after a gi...
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |