One more time, I don't manage to keep special chars ! and ^ in filenames when browsing files, because of EnableDelayedExpansion
I already tried so many things but none worked.
Can you help please?
Code: Select all
setlocal EnableDelayedExpansion
for /f "usebackq delims=" %%i in (`dir /B /O:N "%presets_path%\*.txt"`) do (
:: preset and preset_name loose ! and ^ chars
set "preset=%presets_path%\%%~i"
set "preset_name=%%~i"
:: I need DelayedExpansion enabled here
:: some code
:: ...
set "_sortlist_!indexpos!_!cnt2!=!preset_name!"
set /a presets_cnt+=1
)
:: display results
for /f "tokens=1* delims==" %%a in ('set _sortlist_') do (
:: some code
)
I thought this would works but I have same results.
Code: Select all
setlocal EnableDelayedExpansion
for /f "usebackq delims=" %%i in (`dir /B /O:N "%presets_path%\*.txt"`) do (
setlocal DisableDelayedExpansion
for %%j in ("%%~i") do endlocal &set "preset=%presets_path%\%%~j"
:: ...
)
Thank you