Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for userin.bat

(view source code of userin.bat as plain text)

  1. @ECHO OFF
  2. :: UserInNT.bat
  3. :: How to use the TYPE CON command to receive user input
  4. :: Written by Rob van der Woude
  5. ::
  7. ECHO.
  8. ECHO Demonstration of receiving user input through the TYPE CON command.
  9. ECHO Type in any string and close by pressing Enter, F6 (or Ctrl+Z), Enter.
  10. ECHO Only the last non-empty line will be remembered, leading spaces are ignored.
  11. ECHO.
  13. :: Only one single command line is needed to receive user input
  14. FOR /F "tokens=*" %%A IN ('TYPE CON') DO SET INPUT=%%A
  15. :: Use quotes if you want to display redirection characters as well
  16. ECHO You typed: "%INPUT%"

page last modified: 2023-03-10