If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#16
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUT having to also press carriage return?
In , Ralph Fox
wrote: You cross-posted to the XP newsgroup, so I would guess that you also want the batch script to run in XP. Be aware that CHOICE is not supported in Windows XP. A simple switch can solve that, don't you think? The default would be set to WINXP compatible. If the user changes that switch to anything other than WINXP, then the CHOIC code runs. Something like this Pseudocode: set defos=WINXP if defos not WINXP then run CHOICE commands else run default SET /P commands Does that make sense to you as a general game plan? |
Ads |
#17
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUT having to also press carriage return?
On Wed, 30 May 2018 07:45:54 +0000 (UTC), Bob J Jones wrote:
In , Ralph Fox wrote: You cross-posted to the XP newsgroup, so I would guess that you also want the batch script to run in XP. Be aware that CHOICE is not supported in Windows XP. A simple switch can solve that, don't you think? The default would be set to WINXP compatible. If the user changes that switch to anything other than WINXP, then the CHOIC code runs. Something like this Pseudocode: set defos=WINXP if defos not WINXP then run CHOICE commands else run default SET /P commands Does that make sense to you as a general game plan? Yes, that makes sense. -- Kind regards Ralph |
#18
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUThaving to also press carriage return?
On 30/05/2018 08:11, Ralph Fox wrote:
Be aware that CHOICE is not supported in Windows XP. Nonsense, as in ... Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text] /C[:]choices Specifies allowable keys. Default is YN /N Do not display choices and ? at end of prompt string. /S Treat choice keys as case sensitive. /T[:]c,nn Default choice to c after nn seconds text Prompt string to display ERRORLEVEL is set to offset of key user presses in choices. |
#19
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUT having to also press carriage return?
On Wed, 30 May 2018 12:15:43 +0100, Java Jive
wrote: On 30/05/2018 08:11, Ralph Fox wrote: Be aware that CHOICE is not supported in Windows XP. Nonsense, as in ... Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text] /C[:]choices Specifies allowable keys. Default is YN /N Do not display choices and ? at end of prompt string. /S Treat choice keys as case sensitive. /T[:]c,nn Default choice to c after nn seconds text Prompt string to display ERRORLEVEL is set to offset of key user presses in choices. I tried it on my XP and I get the message that CHOICE does not exist but if I run the DOS 7 version it works so I guess you could just add CHOICE to your windows32 directory. http://gfretwell.com/ftp/CHOICE.COM |
#20
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUT having to also press carriage return?
On Wed, 30 May 2018 12:15:43 +0100, Java Jive
wrote: On 30/05/2018 08:11, Ralph Fox wrote: Be aware that CHOICE is not supported in Windows XP. Nonsense, as in ... Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text] /C[:]choices Specifies allowable keys. Default is YN /N Do not display choices and ? at end of prompt string. /S Treat choice keys as case sensitive. /T[:]c,nn Default choice to c after nn seconds text Prompt string to display ERRORLEVEL is set to offset of key user presses in choices. My XP VM reports the following: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? 'choice' is not recognized as an internal or external command, operable program or batch file. |
#21
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUThaving to also press carriage return?
On 30/05/2018 16:16, Char Jackson wrote:
On Wed, 30 May 2018 12:15:43 +0100, Java Jive wrote: On 30/05/2018 08:11, Ralph Fox wrote: Be aware that CHOICE is not supported in Windows XP. Nonsense, as in ... Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text] /C[:]choices Specifies allowable keys. Default is YN /N Do not display choices and ? at end of prompt string. /S Treat choice keys as case sensitive. /T[:]c,nn Default choice to c after nn seconds text Prompt string to display ERRORLEVEL is set to offset of key user presses in choices. My XP VM reports the following: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? 'choice' is not recognized as an internal or external command, operable program or batch file. You're right. My build was originally a W2k build on a P4 desktop which was reimaged onto a laptop and upgraded to XP, so at the time of my previous post, I made a point of searching the Windows directory for extra files that might be giving the functionality, but in fact CHOICE.EXE is in the W2k Resource Kit folder under Program Files, which is on my path. I suspect that similarly it would be available from the XP Resource Kit, but what bloody arseholes they are, removing something as *useful* as that! Apologies for increasing the level of confusion. |
#22
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUT having to also press carriage return?
Char Jackson wrote:
On Wed, 30 May 2018 12:15:43 +0100, Java Jive wrote: On 30/05/2018 08:11, Ralph Fox wrote: Be aware that CHOICE is not supported in Windows XP. Nonsense, as in ... Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text] /C[:]choices Specifies allowable keys. Default is YN /N Do not display choices and ? at end of prompt string. /S Treat choice keys as case sensitive. /T[:]c,nn Default choice to c after nn seconds text Prompt string to display ERRORLEVEL is set to offset of key user presses in choices. My XP VM reports the following: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? 'choice' is not recognized as an internal or external command, operable program or batch file. Hmmm!? This page is somewhat ambiguous, but says "Windows XP and earlier syntax" (Generally the ComputerHope 'DOS' pages are quite accurate.): https://www.computerhope.com/choicehl.htm [Too much trouble to fetch my dormant XP machine, but if really needed, I can get it, fire it up and try.] |
#23
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUT having to also press carriage return?
On Wed, 30 May 2018 18:09:02 +0100, Java Jive
wrote: On 30/05/2018 16:16, Char Jackson wrote: On Wed, 30 May 2018 12:15:43 +0100, Java Jive wrote: On 30/05/2018 08:11, Ralph Fox wrote: Be aware that CHOICE is not supported in Windows XP. Nonsense, as in ... Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text] /C[:]choices Specifies allowable keys. Default is YN /N Do not display choices and ? at end of prompt string. /S Treat choice keys as case sensitive. /T[:]c,nn Default choice to c after nn seconds text Prompt string to display ERRORLEVEL is set to offset of key user presses in choices. My XP VM reports the following: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? 'choice' is not recognized as an internal or external command, operable program or batch file. You're right. My build was originally a W2k build on a P4 desktop which was reimaged onto a laptop and upgraded to XP, so at the time of my previous post, I made a point of searching the Windows directory for extra files that might be giving the functionality, but in fact CHOICE.EXE is in the W2k Resource Kit folder under Program Files, which is on my path. I suspect that similarly it would be available from the XP Resource Kit, but what bloody arseholes they are, removing something as *useful* as that! Apologies for increasing the level of confusion. The DOS 7 version I linked seems to work. MS went out of their way to kill DOS in XP, to the point of actually saying it was not there but most DOS tools still work fine, as do most DOS programs. The only time you get in trouble, from what I have seen, is when they try to use extended memory or direct disk access. They still seem OK in DOSBOX tho. I am running my dBase IV apps just fine. Most of the simpler DOS programs just load and go seemlessly. |
#24
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUThaving to also press carriage return?
On 30-5-2018 13:15, Java Jive wrote:
On 30/05/2018 08:11, Ralph Fox wrote: Be aware that CHOICE is not supported in Windows XP. Nonsense, as in ... Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\TEMPchoice /? CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text] /C[:]choices Specifies allowable keys. Default is YN /N Do not display choices and ? at end of prompt string. /S Treat choice keys as case sensitive. /T[:]c,nn Default choice to c after nn seconds text Prompt string to display ERRORLEVEL is set to offset of key user presses in choices. ?????????????????????????????????????????????????? ????????? my XP PRO sp3: C:\01-sjouke\testchoice /? choice wordt niet herkend als een interne of externe opdracht, programma of batchbestand. C:\01-sjouke\test Translated:NOT RECOGNIZED!!!!! In dos 6.22 it does work. |
#25
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUThaving to also press carriage return?
On 2018-05-30 03:31, R.Wieser wrote:
B00ze, I use CHOICE.EXE, is it not included in all versions of Windows? Nope. At least, its not on my machine (COM or EXE) Regards, Rudy Wieser Strange. I had a look at who owns Choice.EXE on my Win7pro and it is Trusted Installer, and on top of that it's a hardlink, so I'm not the one who put it there. I also had a look at the Win2k and WinXp resource kits and it's not there, so it doesn't come from the kits. Which version of Windows do you have? Regards, -- ! _\|/_ Sylvain / ! (o o) Memberavid-Suzuki-Fdn/EFF/Red+Cross/SPCA/Planetary-Society oO-( )-Oo "Intel Inside" is a government warning requied by law. |
#26
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUT having to also press carriage return?
B00ze,
Which version of Windows do you have? XP ofcourse (this is the newsgroup for it after all :-) ) service pack 3 (XPsp3). Regards, Rudy Wieser |
#27
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUThaving to also press carriage return?
On 2018-05-31 02:37, R.Wieser wrote:
B00ze, Which version of Windows do you have? XP ofcourse (this is the newsgroup for it after all :-) ) service pack 3 (XPsp3). Ah yes of course ;-) Unfortunately, I removed the drives from my Xp box two weeks ago and do not plan on making it bootable again, so I can't check if I had Choice on mine. Trust Microsoft to remove something in Xp and put it back in Win7 (and then likely remove it again in Win10.) I use Choice on WinPE bootdisks (I have to copy it from System32; Microsoft doesn't copy it when it builds the boot WIM file) and in a few other places, it works very well. I wouldn't be surprised if Choice in Win7 refused to work on Xp, DOS programs did that a lot (I've had to use SETVER a few times.) Regards, -- ! _\|/_ Sylvain / ! (o o) Memberavid-Suzuki-Fdn/EFF/Red+Cross/SPCA/Planetary-Society oO-( )-Oo "Crayons take you more places than starships." -Guinan |
#29
|
|||
|
|||
How do you make a batch file accept 1-char keyboard input WITHOUT having to also press carriage return?
On Sat, 17 Nov 2018 22:14:33 +0000, MikeS wrote:
On 29/05/2018 02:19, wrote: On Tue, 29 May 2018 00:13:59 +0000 (UTC), Bob J Jones wrote: How do you make a batch file accept single-character keyboard input WITHOUT having to also press carriage return? This generic DOS network kill script works great to kill the network, for example, whenever you install programs that you don't want to phone home. https://www.liquidvpn.com/vpn-kill-switches/ All the DOS script does is disable and re-enable the router gateway (192.168.1.1) in the routing table. But it's a pain to always have to hit carriage return after pressing 1, 2, or 3. It would be nice if just pressing the 1, 2, or 3 (or "d" for disable and "e" for enable) worked in the script without the script needing the user to also press the carriage return. FILE: LiquidVPN-Kill-Switch.bat LOCATION: https://www.liquidvpn.com/billing/dl.php?type=d&id=49 Do you know DOS batch scripts well enough to tell us how to eliminate the need to press the carriage return after pressing the (1) to disable the gateway, the (2) to re-enable the gateway, or (3) to set the gateway? Here is a snippet of that code. set defgw=192.168.0.1 echo Your routers gateway is probably "%defgw%" echo -if nothing appears or its incorrect, add it manually (Press '3') echo. echo USAGE: echo. echo -Press "1" to Enable Kill Switch (IP "%defgw%") echo -Press "2" to Disable Kill Switch (IP "%defgw%") echo -Press "3" to manually set default gateway if its not detected above. echo -Press "h" for Kill Switch Help echo -Press "x" to exit Kill Switch. echo. set /p option=Your option: if '%option%'=='1' goto ption1 if '%option%'=='2' goto ption2 if '%option%'=='3' goto ption3 if '%option%'=='x' goto :exit if '%option%'=='h' goto :help echo Insert 1, 2, x or h timeout 3 goto start ption1 route delete 0.0.0.0 %defgw% echo Default gateway "%defgw%" removed timeout 3 goto start ption2 route add 0.0.0.0 mask 0.0.0.0 %defgw% echo Defaulte gateway "%defgw%" restored timeout 3 goto start ption3 echo set /p defgw=your gw IP (e.g. 192.168.0.1): goto start :help cls How do you make a batch file accept single-character keyboard input WITHOUT having to also press carriage return? If you are really using DOS, you load ANSI.SYS and use the PROMPT command to redefine keystrokes to command lines but I am not sure how you do that after W/98. If you can find a copy the real MSDOS CHOICE command will still work in a cmd window. But not with 64 bit Windows 10 as it dates back to 16 bit days. I have a copy of CHOICE.COM from a PCDOS 7.1 disk if anyone wants to play with it. |
|
Thread Tools | |
Display Modes | |
|
|