SQLCMD mode: environment variable syntax?
The sqlcmd syntax for setting variables is :setvar.  You can access environment variables from sqlcmd mode (using the $(variableName) syntax) however I find these case-sensitive and it's  a bit fussy about what you can and can't do.  Try this, hopefully it makes sense:

:setvar mypath "$(SystemRoot)"

:out $(SystemRoot)\test.txt     -- will work

print '$(mypath)'   -- oops won't work
print '$(SystemRoot)'   -- should work

go

:out stdout