Not only cmd.exe
, but I mean all standard utilities in windows (supported by WinXP-Win7).
Why would it need to be possible for, say, edlin.exe
? That's a nonsensical requirement.
If you want to prompt for a single character, returning immediately once one is entered, then you are going to have to use some form of extra utility over and above what comes in the box with Windows NT 5.1, even if it's simply a Win32 clone of the MS-DOS 6.2 choice.com
program (which, being an MS-DOS program, won't work on x86-64 Windows, of course).
With JP Software's TCC/LE, which is a replacement command interpreter, the built-in INKEY
command does exactly what you ask for and can be used thusly:
inkey %%key
The key pressed is then in the key
environment variable.
Alternatively, in the Windows NT 4.0 Server Resource Kit and later, Microsoft provides choice.exe
, which is a Win32 clone of the MS-DOS choice.com
. Note, however, that this is the Server Resource Kit. With Windows NT Server 5.2 and later, choice.exe
is bundled in with Windows itself. However, again, note that this is the Server edition of Windows.