I am so confused and frustrated with this - I hope someone can help.
The following does not work:
WinExec("cmd.exe /c for /F \"tokens=*\" %c in (\'dir /s /b %TEMP%\\*MyProgram.exe\') do (%SYSTEMROOT% & cd %~pc & start \"%c\")", SW_HIDE);
But, the following 2 lines work just fine:
1 2
WinExec("cmd.exe /c for /F \"tokens=*\" %a in (\'dir /s /b PROGRAMS\') do (if not exist \"%TEMP\\PROGRAMS%~pa\" md \"%TEMP%\\PROGRAMS%~pa\")", SW_HIDE);
WinExec("cmd.exe /c for /F \"tokens=*\" %b in (\'dir /s /b PROGRAMS\') do (PROGRAMS\\program.exe \"%b\" \"%TEMP%\\PROGRAMS%~pnb\")", SW_HIDE);