Use cmd.exe /c instead of cmd /k, and add /b to exit.