C++ _popen() / system() running consecutive commands on windows -


i working on remote command prompt server of mine. running issue both _popen() , system() because once command executes , process close/start new instance (losing variables active directory). want able run code like.

_popen("cd ..","r"); _popen("cd windwos","r"); _popen("dir","r"); 

i need method of getting pointed output text (this why started using _popen(). not sure if possible _popen(), or need use else.

for changing directory, need in current process. need piece of code this:

if (cmd == "cd" || cmd == "chdir") {    chdir(argv[1]);  } 

the reason running "cd" inside popen doesn't work inly changes directory in current process. making change parent process cause manner of problems.

of course, may need intercept few other things, example "set" (for environment variables), perhaps.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -