Environment variables and Process.Start

This is a problem that I’ve come across a couple of times now. I want to spawn a process from .Net with changes to the path or other environment variables, but I don’t want to modify the local environment variables for the calling process. Or I need to run a third-party batch file that configures the environment, and then run something else.
Uh oh. No good, because each of the Processes spawn with their own local copy of the environment, and so the environment that is used by app.exe is a fresh copy of the environment used by the .Net app. The easiest solution is to just create another batch file that calls them both and call that instead.
But as soon as it gets more complicated than that, the preferred solution is to run the two in the same environment, which can be done by running a process and redirecting standard input.
Process proc = new Process();
proc.StartInfo.FileName = "cmd.exe"; 
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardInput = true;

StreamWriter cmdWriter = proc.StandardInput;

Now the changes to the environment made by setenv.bat will persist and affect the execution of app.exe.