Timeout not working in file-works in command line

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
dtmenges
Posts: 2
Joined: 28 Jun 2023 18:40

Timeout not working in file-works in command line

#1 Post by dtmenges » 28 Jun 2023 19:04

I am having a problem using timeout in a batch file. It seems to go into some sort of loop. When I put the following code in a batch file, it just continuously echos "Hello World" until I Ctrl-C to end.

@echo off
echo Hello World
timeout /T 5
pause

I've tried this on both Window 7 and Windows 10 with the same results. If I enter timeout /T 5 in a command line, it works as expected.

Regards,
Dave

jeb
Expert
Posts: 1042
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: Timeout not working in file-works in command line

#2 Post by jeb » 29 Jun 2023 01:55

Hi dtmenges,

I guess you called your batch file "timeout.bat"?
Think a bit about the name

dtmenges
Posts: 2
Joined: 28 Jun 2023 18:40

Re: Timeout not working in file-works in command line

#3 Post by dtmenges » 29 Jun 2023 05:23

How about that! Renamed to test.bat and everything is just peachy.

Thanks, Jeb.

Dave

Post Reply