Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch Script "Timeout" Error: Invalid Syntax. Default option is not allowed more than 1 time

First off, I'm using Windows 7 64-bit, if it makes a difference. I have a batch file in which I'm using the "timeout" function, written as such:

*code does some things*
timeout /t 100 rem wait for 100 seconds for the above thing to finish

If I do timeout /t 100 in the command line, it waits for 100 seconds as I would expect. However, in the script it gives me the error:

ERROR: Invalid syntax. Default option is not allowed more than '1' time(s).
Type "TIMEOUT /?" for usage.

The instructions for timeout are /t for number of seconds to wait, /nobreak to ignore keypresses, and /? to display the help message. I'm not sure what syntactical error I'm having, or what "default option is not allowed", especially since it seems to work perfectly fine outside of the batch file.

like image 200
Michael C Avatar asked May 29 '26 15:05

Michael C


2 Answers

rem wait for 100 seconds for the above thing to finish
timeout /t 100

You cant's set a comment on the same line as the command.

like image 87
npocmaka Avatar answered May 31 '26 05:05

npocmaka


A comment is another command. So if you want it on the same line you need to use the & like this.

timeout /t 100 & rem wait for 100 seconds for the above thing to finish
like image 39
RGuggisberg Avatar answered May 31 '26 06:05

RGuggisberg