Even if you now know what you did wrong. You should still say in your question. Your question is badly asked 'cos you're asking why it is that what you did didn't work and you didn't show exactly what you did. Paste the commands you did.
Here is how one would use setx. This works.
C:\>setx aaa rrr
SUCCESS: Specified value was saved.
Here is proof that it set-
C:\>@REG QUERY "HKCU\Environment"
TEMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\Temp
TMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\Temp
aaa REG_SZ rrr
now if you do set(the command to view the environment variables), the value won't show up. But open a new cmd window and do set, and it shows. It is in the user env variable section. rather than the system one.
For the system environment variable, you need
setx aaa 123 -m (i.e. -m at the end), and the location in the registry for system variables, in xp or 7, would be
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and you'd need the cmd prompt in administrative. And watch out with the path you should back it up
setx pathbk "%path%" -m
I recommend writing a batch file to permanently set %uvar% and %mvar% to point to the registry locations for the environment variables
setx mvar "%mvar%"
setx uvar "%uvar%"
then you can do
reg query %uvar%
reg query %mvar%
Note- setx can be a bit dangerous, writing something you didn't intend, so do set>a.a first so you have a backup.