I am aware of the CreateProcess use to launch a new process. I want to know if I could use it in a situation like this

1. I want to launch the windows command prompt(cmd.exe) and run a batch file on the command prompt to set some environment.

2. After this I want to run an executable on the same command prompt and want the control to return to my C code after the execution of the executable.

I know I can achieve one of these 2 using CreateProcess. However, is there a way to perform both the tasks?

If not, is there any alternate method that I can use?