So are we saying that the previous posts of code ... use of EXPANDENVIRONMENTVARS ... were done incorrectly??

Because all of the above examples didn't return any value for %CLIENTNAME%.