Pass through "env" in cmd.script

Fixes #9002.