How to Emulate a Cmd Shell Command(i.e. "cd") and Effect the State of the Command Prompt on Exit
I would like to emulate the standard command line prompt command "CD" to create an extended version that, for example, provides a search capability.开发者_Python百科 My research has not led me to a way to change the current directory path of a host shell.
It is quite murky how the command interpreter's CD command would do anything to enhance a 'search capability'. Starting one with the right 'CD' directory isn't difficult. Just use CreateProcess to start cmd.exe. The lpCurrentDirectory argument lets you set the current directory. ShellExecuteEx() works too, a bit easier to get right.
精彩评论