CreateProcess doesn't pass command line arguments

前端 未结 8 2148
梦谈多话
梦谈多话 2020-12-01 10:20

Hello I have the following code but it isn\'t working as expected, can\'t figure out what the problem is.

Basically, I\'m executing a process (a .NET process) and pa

相关标签:
8条回答
  • 2020-12-01 11:22

    You should specify also the module name in parameters: LPTSTR cmdArgs = "App name@example.com"; It should be the whole command line (including argv[0]).

    0 讨论(0)
  • 2020-12-01 11:22

    You can add a space as first character of the cmdArgs string:

    LPTSTR cmdArgs = " name@example.com";

    Apparently Windows appends the 2nd argument string to the application name represented by the first argument, and the result is passed as command line arguments to the executable. So adding a space will properly separate the arguments.

    0 讨论(0)
提交回复
热议问题