Nafalem
Nafalem

Reputation: 371

CMD.exe How to create INI filelist with CMD

how to create INI file of file list with cmd?

eg. This will create print list of all txt files...

dir /b *.txt > FileList.log

Readme.txt
Info.txt
Data.txt

but how to create INI filelist of all *.txt files in directory with cmd?

[Uninstall]
file1=Readme.txt
file2=Info.txt
file3=Data.txt

Upvotes: 0

Views: 1245

Answers (1)

jpw
jpw

Reputation: 44911

Try this:

@echo off
@echo [Uninstall] > FileList.log
setlocal enabledelayedexpansion
set /a counter=0
for /F "delims=" %%i in ('dir /b *.txt') do (
  set /a counter=!counter!+1
  echo file!counter!=%%i >> FileList.log
)

Upvotes: 1

Related Questions