开发者

How to Emulate a Cmd Shell Command(i.e. "cd") and Effect the State of the Command Prompt on Exit

开发者 https://www.devze.com 2023-01-27 00:45 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消