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. :: http://www.robvanderwoude.com
  6.  
  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.
  12.  
  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%"
  17.  

page last uploaded: 2017-04-06, 13:33