How to backspace the characters in the cmd buffer?
CMD does support the backspace key, and it does work as you describe when you're typing a command before executing it.
Once you've begun the command (php.exe in this case) then STDIN is attached to that program (not CMD) and therefore it's up to that program whether it implements or allows backspacing or not.
To the program, the backspace key is just another character that it needs to process (e.g. ASCII #8).
Related videos on Youtube
Comments
-
Pacerier over 1 year
If we use command prompt to run short scripts as such:
C:\php> php.exe <?php echo 'test'; ?>
, the output would be displayed directly in the command prompt:
test ^C C:\php>
So let's say there are typo errors and I'd like to do a "backspace".
E.g. assuming we mistyped
echo
asechoo
:C:\php> php.exe <?php echoo 'test';
How can I achieve "backspace" behavior on cmd without having to abort the full script and retype everything from scratch?
-
Pacerier over 9 years(For apps that do not implement this feature) In other words, are you saying that it's not possible to "hack" around this limitation?
-
justinsg over 9 yearsOnce you've executed the app, no. However for PHP, you could try this: php.net/manual/en/features.commandline.interactive.php
-
Pacerier over 9 yearsAh, was thinking some sort of "standard" protocol would have been built by now to tackle this annoying issue....
-
TOOGAM about 9 years@Pacerier : Nope: The keyboard buffer was supported by the old BIOS systems from way back in the pre-486 days. It was limited to 16 keystrokes, I think. Pressing backspace would use up another one of those 16 remembered keystrokes, not remove one. Nowadays technology may have advanced; maybe operating systems support unlimited buffers these days, I don't know. But the behavior is still based on the design of compatibility with the old standard. Since so many people are attached to using rodents, improving experiences keyboard buffers has not been widely viewed as a very critical priority.