Pass through "env" in cmd.script

Resolves #9002.