views:

164

answers:

1

Hello,

i have this batch file, which makes constantly a loop. I want the user to be able to terminate it in the batch, not just clicking the X.

This is what i need (somehow):

@echo off
:proc
cls
rem All kind of stuff...
echo Hit any key to terminate...
sleep 1
@pause>nul

But, of course, sleep and pause can't work at the same time.

How is it possible?

+4  A: 

Remove the pause and change the message to "Hit Ctrl-C to terminate". Presumably the script has a "goto :proc" that you are not showing?

anon
eh yes! Thank you!
YourComputerHelpZ
Yeah, but then, it asks if i'm sure; i don't want that.
YourComputerHelpZ
I don't think there is any way of avoiding this message - certainly many of the suggested fixes I've seen like using the "start" command don't work. IMHO, the best solution, if it is possible for you, is to switch to a better command interpreter, such as MSYS bash.
anon
The problem is, that it is not possible. Isn't it possible, on VBScript, or so?
YourComputerHelpZ