I've been working on updating one of our batch files to read/build menu's based on values held within an INI file... I've got the menu-build working a treat now but would like to tweak it a little and it's leaving me stumped!!
Current Code is as follows:
for /F "usebackq tokens=1-4* delims=,=" %%A in ("%MENU_INI_FILE%") do (
if /I "!Name:~0,15!" EQU "SDQ_MAINMENUOPT" (
if "!NewMenuName!" EQU "" (set NewMenuName=%%~B) else (set NewMenuName=!NewMenuName!,%%~B)
if "!NewMenuLoca!" EQU "" (set NewMenuLoca=%%~C) else (set NewMenuLoca=!NewMenuLoca!,%%~C)
if "!NewMenuAdm!" EQU "" (set NewMenuAdm=%%~D) else (set NewMenuAdm=!NewMenuAdm!,%%~D)
REM CALL :check_filetype
set /a i=0
for %%A in (%NewMenuName%) do (
set /a i+=1
echo. [!i!] - %%A
The 1st part within the ini value will be the name of the option, which when input will have underscores under every word (to keep it all as one value when read). When the script builds the menu, I want it to strip out the underscores and replace with a space...
I've done this before for filenames etc where I would use
But I can't seem to get this to work anywhere without either falling over, or repeating the last value over and over again! Any help appreciated!