Page 1 of 1

how to handle special characters in file names

Posted: 06 Apr 2020 06:23
by Ninon
Hi there,

I have trouble to extract some data out of an single.txt file (the file name contains signs like: . and =).
The input (%1) is a txt files that contains all the single.txt files.

Somehow, the second for loop doesn't work...

Code: Select all

SETLOCAL ENABLEDELAYEDEXPANSION
if exist PJ_Overview.txt del PJ_Overview.txt

echo Writing output text file. Please wait - can take a few minutes...
echo.
echo file:

set /A _Anzahl=0
set "TAB=	"

for /f %%i in (%1) do (
	for /f "tokens=1,2" %%j in (%%i) do if [%%j]==[VERSION] (
	echo %%j>>PJ_Overview.txt
	)
	set /A _Anzahl += 1
	echo !_Anzahl!%TAB%%%i%TAB%%%j>>PJ_Overview.txt
)
Does anyone has a hint for me?
Thank you!

Re: how to handle special characters in file names

Posted: 14 Apr 2020 04:53
by penpen
The diagnosis "doesn't work" isn't helpfull:
So please provide sample files (minimum, representative and short examples) that produces the error and
specify what you expect to see and what the result of your code is, so we can test the effects of changes to the code.

penpen