Before running a cmd command in c++, I want to set some temporary environment variable, Which gets deleted with end of command line session.
for e.g. before executing below cmd command, I want to set P4PASSWD
perforce environment variable.
sprintf_s(p4Command, 500, "/C p4.exe print -o \"%s\" -q %s", destination, source);
LPCSTR Command = p4Command;
ShellExecute(0, "open", "cmd.exe", Command, 0, SW_HIDE);
This can be possible if we are allowed to execute multiple cmd commands in one session. But I don't know how it can be achieved.Please let me know if some more inputs are required.