![]() ![]() This took around 30 seconds, even though 5*5=25. To understand better what ping does in practice, I ran ping 192.0.2.0 -n 5 -w 5000 GOOD> :: wait 10000 milliseconds, ie 10 secs Putting the comment on its own line before the ping worked fine. However the software returned almost instantly. I tried the above too, after reading that comments could be added to BAT files by using two consecutive colons. And each ping attempt probably lasted around a second making an estimated 9 seconds in total. My explanation is that there are 5 ping attempts, each about a second apart, making 4 seconds. One ping attempt lasting a specified 3 seconds. This seemed to give a three second delay as expected. I have tried the various solutions given here on an XP machine, since the idea was to have a batch file that would run on a variety of machines, and so I picked the XP machine as the environment likely to be the least capable. The extra signs mean that I see the "done" text and the waiting occurs without me being distracted by their commands. The echo done allows me to see when the script finished and the ping provides the delay. This is the latest version of what I am using in practice for a ten second pause to see the output when a script finishes. So far, using sleep.exe seems to be more reliable. 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. 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. Ĭ:\test.proj(5,7): error MSB3073: The command "timeout /t 5 " exited with code 1. Ĭ:\test.proj(5,9): error MSB3073: The command "choice /C YN /D Y /t 5 " exited with code 255.ĮXEC : error : Input redirection is not supported, exiting the process immediately. I ended up using sleep.exe from, which is nice because it doesn't require any install and it's tiny.ĮXEC : error : The file is either empty or does not contain the valid choices. I was trying to do this from within an msbuild task, and choice and timeout both did not work due to I/O redirection. When you use ERRORLEVEL parameters in a batch program, listĬHOICE /C YNC /M "Press Y for Yes, N for No or C for Cancel."ĬHOICE /C ab /M "Select a for option 1 and b for option 2."ĬHOICE /C ab /N /M "Select a for option 1 and b for option 2." If the user pressesĬTRL+BREAK or CTRL+C, the tool returns an ERRORLEVEL value If the user presses a key that is not a valid choice, the tool Listed returns a value of 1, the second a value of 2, and so on. Key that was selected from the set of choices. The ERRORLEVEL environment variable is set to the index of the M text Specifies the message to be displayed before D choice Specifies the default choice after nnnn seconds.Ĭharacter must be in the set of choices specifiedīy /C option and must also specify nnnn with /T. If 0 is specified, there will be no pause T timeout The number of seconds to pause before a defaultĬhoice is made. CS Enables case-sensitive choices to be selected.īy default, the utility is case-insensitive. The message before the prompt is displayed N Hides the list of choices in the prompt. C choices Specifies the list of choices to be created. Of choices and returns the index of the selected choice. This tool allows users to select one item from a list ![]() I think it is the same on XP, but look at the help text on an XP computer to verify. A partial work-around is to obfuscate the situation - use the /N argument to hide the list of valid choices and only have 1 character in the set of choices so it will be less likely that the user will type a valid choice before the timeout expires.īelow is the help text on Windows Vista. The one thing that might be an issue is if the user types one of the choice characters before the timeout period elapses. Use the /T parameter to specify the timeout in seconds and the /D parameter to specify the default selection and ignore then selected choice. ![]() It's been around since MSDOS 6.0, and should do the trick. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |