I was trying to do this from within an msbuild task, and choice and timeout both did not work due to I/O redirection.
I ended up using sleep.exe from http://sourceforge.net/projects/unxutils, which is nice because it doesn't require any install and it's tiny.
Trying with choice
:
Results in:
TestCmd:
choice /C YN /D Y /t 5
EXEC : error : The file is either empty or does not contain the valid choices. [test.proj]
[Y,N]?
C:\test.proj(5,9): error MSB3073: The command "choice /C YN /D Y /t 5 " exited with code 255.
Trying with timeout
:
Results in:
TestCmd:
timeout /t 5
EXEC : error : Input redirection is not supported, exiting the process immediately. [test.proj]
C:\test.proj(5,7): error MSB3073: The command "timeout /t 5 " exited with code 1.
Aside:
I am actually using
because I am executing dbghost.exe multiple times in parallel and it creates temp files/databases based on the current epoch time in seconds - which of course means if you start multiple instances, each uses the same temp name. I was originally trying to use MSBuild Extension Pack Thread.Sleep
command, but it seems that (usually) it was running the sleep task fine, but then starting the
task in all threads at the same time, and of course dbghost.exe would fail with conflicts. So far, using sleep.exe seems to be more reliable.