I am using SET in cmd to set a new environment variable, and immediately use it afterwards for comparison. The user is prompted to input a string, and afterwards it should check if the input matches another string (basically a password).
set /P pwd=pwd: & if %pwd%==pwd (echo yes) else (echo no)
The problem I'm having is that it appears that the variable is not set, because no matter if I input the password or not, it always returns me No.
I have also tried separating both commands in a .bat file, but it wouldn't work either.