I want to run multiple separate commands in the same instance of PowerShell using C++.
The first command would be cding into a folder containing a python venv.
cd C:\\FolderPath
The second command would be ./Scripts/activate
to run the virtual environment, with more commands possible later in the code.
I am aware of using ";" to separate commands in PowerShell, but for my purposes I would like to have separate command sets. For example something like:
auto cmdInstanceStore = GetCMDInstance(system("PowerShell"));
system("cd C:\\FolderPath", cmdInstanceStore); //Passing cmdInstanceStore runs the cd C:\\FolderPath command in the same cmd in which PowerShell command ran
system(".\Scripts\activate, cmdInstanceStore); //Passing cmdInstanceStore runs the .\Scripts\activate command in the same cmd in which PowerShell and cd command ran
//run more cpp code//
system("command 1", cmdInstanceStore); //Same idea as before, command 1 would run in the same cmd as previous commands (command 1 would have access to env variable in the virtual environment activated earlier)
I am on Windows 10. Any help would be appreciated, thanks.