This is not a trivial task as each process has its own environment variables table, especially if the environment variable should not be set permanently for all running processes.
The solution is quite simple.
In your C# application create a batch file with the line:
set YourVar=datayyyymmdd
The C# application could create this batch file with name "SetYourVar.bat" in directory for temporary files. The path of the temporary files directory can be get within the C# application from environment variable TEMP.
Your batch file contains the lines:
@echo off
"Full\Name\Of\C#\ConsoleApplication.exe" "parameters for this application"
if exist "%TEMP%\SetYourVar.bat" (
call "%TEMP%\SetYourVar.bat"
del "%TEMP%\SetYourVar.bat" >nul
)
"Full\Name\Of\Other\DOS\Application.exe"
So instead of trying to set the environment variables to use in other applications directly within the C# console application, write the lines to set them into a batch file called next by the batch file which started the C# console application and next deletes this temporary batch file just used to set environment variables.