CNTR+C,Y,ENTER programmatically equivalent

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tebee
Posts: 13
Joined: 21 May 2011 08:41

CNTR+C,Y,ENTER programmatically equivalent

#1 Post by tebee » 29 May 2011 23:40

hi to all,
I would need to have a main slow repeating process inside a loop to make it running or stop it.
The batch idea to use a set /p on top or bottom of the loop, waiting for a key to stop, is good but as process itself could last hours i do not know if keyboard cue is read during the steady u.i. time.
Another way of stopping is CNTR+C,Y,ENTER but it kills the process and loose all temporary stored data by the process.
Among the two the latter is good in contingency, but the sequence is long, do there is any code example to substitute it?
Also, if i remember well, dos choice was able to create a shell for processes waiting a single keypress to escape from it, another way of implementing.
Any suggestion?

Thanks

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: CNTR+C,Y,ENTER programmatically equivalent

#2 Post by orange_batch » 29 May 2011 23:55

I don't understand well what you mean, but you might try WshShell's SendKeys method through VBScript.

tebee
Posts: 13
Joined: 21 May 2011 08:41

Re: CNTR+C,Y,ENTER programmatically equivalent

#3 Post by tebee » 30 May 2011 06:20

Me too, :roll: , i am not in my mother language, beg pardon
Actually: what if you have a repeating process that takes 20min to complete each run and you want to stop before it starts again with another instance?
My guess:(1) use the set /p or combination of goto and set /p to quit the loop at next iteration (2)use CNTR+C/Y/ENTER to quit immediately (3)use an alternate of msdos choice
Know problems:(for item 1)is not possible to have an acknowledgement of the iterations being quit at end of present run (2)actually CNT.. kills everything and leave the process as it never run or with not useful traces (3)msdos choice is evil, other have same functionality, but probably there are coding examples that avoid the use of machine language binaries.
Can someone give a suggestion? At least the coding to make <CNTR-C/Y/ENTER> programmacally, like <X/ENTER>
Adv. Thanks

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: CNTR+C,Y,ENTER programmatically equivalent

#4 Post by Ed Dyreen » 30 May 2011 06:27

I don't understand you, maybe you should post the bit of script that you have already.
And explain it one step at a time because I'm no good in english, but you are worse :?
What is your mother language ?, just curious...

Are you looking for a way to enter keystokes, or ? waiting for a process to complete & then close it ?

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

Re: CNTR+C,Y,ENTER programmatically equivalent

#5 Post by alan_b » 30 May 2011 10:17

How about :-

Code: Select all

@ECHO OFF
:START
ECHO PRETEND THIS IS A LONG SLOW PROCESS
ECHO LONG SLOW PROCESS is now concluded and pausing
PAUSE
ECHO REPEAT LONG SLOW PROCESS
GOTO START


Regards
Alan

Post Reply