batch file - I can't get a variable of loop -


i trying write simple batch file

the script gets namefile file "dump" , split string, can't display variable !!

for /r %%a in (dump\*) (         set file=%%a         /f %%i in ("%%a") (         /f "tokens=1 delims=-"  %%d in ("%%~ni") set db=%%d               )  echo %db% ) pause 

any ideas?

thanks help.

try setting setlocal enabledelayedexpansion , swapping var exclamation marks instead, see below:

setlocal enabledelayedexpansion /r %%a in (dump\*) (         set file=%%a         /f %%i in ("%%a") (         /f "tokens=1 delims=-"  %%d in ("%%~ni") set db=%%d               )  echo !db! ) pause 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -