You cannot nest delayed expansion like set currentpasswd=!!currentlogin!password!, because this first detects !!, which are combined to one opening !, so the variable expansion !currentlogin! is done resulting in a222333, then there is the literal part password, and finally another ! that cannot be paired and is therefore ignored.
However, you could try this, because call initiates another parsing phase:
call set "currentpasswd=%%!currentlogin!password%%"
Or this, because for variable references become expanded before delayed expansion occurs:
for /F "delims=" %%Z in ("!currentlogin!") do set "currentpasswd=!%%Zpassword!"
Or also this, because argument references, like normally expanded variables (%-expansion), are expanded before delayed expansion is done:
rem // Instead of `set currentpasswd=!!currentlogin!password!`:
call :SUBROUTINE currentpasswd "!currentlogin!"
rem // Then, at the end of your current script:
goto :EOF
:SUBROUTINE
set "%~1=!%~2password!"
goto :EOF
rem // Alternatively, when you do not want to pass any arguments to the sub-routine:
:SUBROUTINE
set "currentpasswd=!%currentlogin%password!"
goto :EOF
All these variants have got two important things in common:
- there occur two expansion phases;
- the inner variable reference is expanded before the outer one;