


Otherwise, the variable is ignored and an error message is displayed. For this for /f is used to process the file extension. This will give us two tokens, left and right sides of the underscore.

Code: off setlocal ENABLEDELAYEDEXPANSION set testStr='./skooby/doo dd/george town/files/make/this/a/really/long/pathname/da.log' echo input string:%testStr% set /a delimCnt=11 FOR /F 'usebackq tokens=1-%delimCnt% delims=/'%%a IN ('%testStr%') DO ( echo a:%%a echo b:%%b set /a asciiCtr=97 set asciiChar= call:convertValToAsci asciiCtr asciiChar echo asciiChar:!asciiChar! REM the next line I would like to echo the loop variable '%%a' echo%%!asciiChar! ) goto:veryEnd REM REM Convert input decimal value to ascii REM REM usage: 1st parm = input value, 2nd parm = output variable:convertValToAsci set /a valIn=%1 cmd /c exit /b%valIn% set%2=%=ExitCodeAscii% goto:EOF REM :veryEnd endlocal echo Done. To use this command in a batch file, replace every occurrence of f with f. Tokens In Batch File Batch File Programming ) do echonfxf Once we have the two elements, we need to split the extension using the underscore as a delimiter. I'd like to do the following within the for loop: take a value and convert it into an ascii char and then use that result as the for loop variable name. Tokens basically tell the batch file where to look to set the variable (a). I have a 'function' for converting a value to the char however I don't know if this level of expansion is possible. For that example I'd want to process the variables '%%h', '%%i' and '%%j'. in a batch file use G (on the command line G) FOR /F processing of a text file consists of reading the file, one line of text at a time and then breaking the.
