0

I try to create visual studio post-build event command line and i want:

  1. to kill process if exist;
  2. copy file;
  3. launch a program;

start taskkill /f /im app.exe /t & xcopy /y "$(TargetPath)" "C:\Program Files (x86)\path\$(TargetFilename)" & start "" "C:\Program Files (x86)\program\app.exe"

I use start taskkill /f /im app.exe /tinstead of taskkill /f /im app.exe /t because if the process not exists i get not found error

Now all tree command runs OK with no error but the last command not launch the program but if i execute this command separately the program is executed.

How can i fix this?

TotPeRo
  • 6,561
  • 4
  • 47
  • 60

1 Answers1

1

You have a Timing Problem.

Try:

start /wait taskkill /f /im app.exe /t & xcopy /y "D:\Workspaces\Dev\path\bin\Debug\my.dll" "C:\Program Files (x86)\path\my.dll" & start "" "C:\Program Files (x86)\program\app.exe"
Stephan
  • 53,940
  • 10
  • 58
  • 91