Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Winapi Win32 API与CreateProcess类似,但可在bat/cmd/etc上工作(即使用PATHEXT)_Winapi_Createprocess - Fatal编程技术网

Winapi Win32 API与CreateProcess类似,但可在bat/cmd/etc上工作(即使用PATHEXT)

Winapi Win32 API与CreateProcess类似,但可在bat/cmd/etc上工作(即使用PATHEXT),winapi,createprocess,Winapi,Createprocess,如果使用,则它仅在.exe上有效。使用其他可执行文件类型的最佳方法是什么 到目前为止,我们所能做的最好的事情就是在这种情况下预先添加cmd/c。这真的是正确的方法吗?批处理文件在技术上不是可执行文件,它们只是注册为使用cmd打开。正如您提到的,您需要操作I/O句柄的能力,您最好的选择确实是将CreateProcess与cmd/c一起使用,您在说什么?@我觉得这行不通;例如,我需要能够发送流程的输入和捕获流程的输出,我通过p流程信息结构获得CreateProcess。CreateProcess()

如果使用,则它仅在.exe上有效。使用其他可执行文件类型的最佳方法是什么


到目前为止,我们所能做的最好的事情就是在这种情况下预先添加
cmd/c
。这真的是正确的方法吗?

批处理文件在技术上不是可执行文件,它们只是注册为使用
cmd
打开。正如您提到的,您需要操作I/O句柄的能力,您最好的选择确实是将
CreateProcess
cmd/c

一起使用,您在说什么?@我觉得这行不通;例如,我需要能够发送流程的输入和捕获流程的输出,我通过
p流程信息
结构获得
CreateProcess
CreateProcess()
就其性质而言,仅适用于可执行文件(通常包括批处理文件)。其他任何东西都是一个“文档”,并且有一个自定义处理程序,您可以使用
ShellExecute()
ShellExecuteEx
调用它,它不具备重定向stdio句柄的能力,而
CreateProcess
是通过
STARTUPINFO
hStdInput
hStdError
句柄来重定向stdio句柄的。