Hey guys,
Is it possible to add something similar to the "pause" command, but instead of being able to press any key to continue, the user must press "Enter" to continue? Or is there a way to quit the batch file by pressing "Esc" or some key combination other than "Ctrl+C"? Thanks for any help!
Question About Keyboard Input
Moderator: DosItHelp
-
- Posts: 82
- Joined: 24 Apr 2011 19:20
Question About Keyboard Input
Last edited by alleypuppy on 19 Jun 2011 10:26, edited 1 time in total.
Re: Question About Keyboard Input
CTRL+C, I believe this is the old BREAK is ON command.
I use choice to wait for keypress, this allows timeouts, I'm looking for an ANY key solution aswell...
I use choice to wait for keypress, this allows timeouts, I'm looking for an ANY key solution aswell...
-
- Posts: 82
- Joined: 24 Apr 2011 19:20
Re: Question About Keyboard Input
The ASCII Character Set defines ^C as being "End of Text", which I guess is the same as "goto :eof"
Re: Question About Keyboard Input
☺
hey alley, can you test if choice accept ascii 13 as input ?
I believe that ascii 13 is the Carriage Return <ENTER> key.
You create this key like this...
I can't test it now
This probably wont work
It must be inserted as a literal or escaped character, just guessing...
It should be possible, I'm getting back to this...
hey alley, can you test if choice accept ascii 13 as input ?
I believe that ascii 13 is the Carriage Return <ENTER> key.
You create this key like this...
Code: Select all
::--------------------------------------------------------------------------------------------------------------------------
%@Pre% $CR, &%@echon%use only with DelayedExpansion
::(
for /f %%a in ('copy /Z "%~dpf0" nul') do set "$CR=%%a"
::
%@nechon% This is erased!$CR! This Works .
::)
%@Post% $CR use only with DelayedExpansion [OK]
::--------------------------------------------------------------------------------------------------------------------------
I can't test it now
This probably wont work
Set defines ^C as being "End of Text", which I guess is the same as "goto :eof"
It must be inserted as a literal or escaped character, just guessing...
It should be possible, I'm getting back to this...
Last edited by Ed Dyreen on 19 Jun 2011 11:08, edited 2 times in total.
-
- Posts: 82
- Joined: 24 Apr 2011 19:20
Re: Question About Keyboard Input
No it didn't seem to work.
-
- Expert
- Posts: 442
- Joined: 01 Aug 2010 17:13
- Location: Canadian Pacific
- Contact:
Re: Question About Keyboard Input
You can program a routine that involves set /p to do this.
-
- Posts: 44
- Joined: 01 Jan 2011 20:54
Re: Question About Keyboard Input
here might be the error in ed's code:
on time it says:
%@echon%
another time it says:
%@nechon%
fix either and it might work
~C~
on time it says:
%@echon%
another time it says:
%@nechon%
fix either and it might work
~C~
Re: Question About Keyboard Input
☺
@orange
I'm sorry for posting you incomplete code @alley
@orange
@orange
This time I agree%@echon%
another time it says:
%@nechon%
fix either and it might work
Code: Select all
set "@echon=echo("
set "@nechon=%@echon% &%@echon%"
@orange
So how would you code set /p so it resumes on any key, it won't support timouts thoughYou can program a routine that involves set /p to do this.