fork download
  1. #include <stdio.h>
  2.  
  3. const char *getCmdLine(const char *cmd) {
  4. if (*cmd == '"') while(*++cmd != '"') ;
  5. while (*cmd != ' ') ++cmd;
  6. while (*cmd == ' ') ++cmd;
  7. return cmd;
  8. }
  9.  
  10.  
  11.  
  12. int main(void) {
  13. // \\?\ - читать тут - https://h...content-available-to-author-only...r.com/ru/post/307186/
  14. const char *commandLine = "\"cmd.exe /c\"\"\\\\?\\C:\\program files\\1 2.exe\" \"1.cmd\" %home%";
  15. // забыл пробел вот тут -----------------▲
  16. printf("%s\n", commandLine);
  17. printf("%s\n", getCmdLine(commandLine));
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 4244KB
stdin
Standard input is empty
stdout
"cmd.exe /c""\\?\C:\program files\1 2.exe" "1.cmd" %home%
files\1 2.exe" "1.cmd" %home%