Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for usrinput.cmd

(view source code of usrinput.cmd as plain text)

  1. @ECHO OFF
  2. REM * Ask for USeR INPUT and store it in variable USRINPUT
  3. REM * OS/2 version
  4. REM * Written by Rob van der Woude
  5.  
  6. SET USRINPUT=
  7.  
  8. REM * Turn on ANSI key translation (translate Enter
  9. REM * key to F6+Enter sequence) and ask for input:
  10. ECHO Enter one word only . . .
  11.  
  12. REM * Copy entered text to temporary file:
  13. COPY CON %TEMP%.\~USRINP.TMP
  14.  
  15. REM * Turn off ANSI key translation and clear irrelevant screen output:
  16. ECHO 
  17.  
  18. REM * Add empty line to temporary file. The empty line
  19. REM * will be used to stop DATE asking for new date.
  20. ECHO.>> %TEMP%.\~USRINP.TMP
  21. ECHO.>> %TEMP%.\~USRINP.TMP
  22.  
  23. REM * Create a temporary batch file that will store the
  24. REM * entered text into the environment variable USRINPUT:
  25. TYPE %TEMP%.\~USRINP.TMP | DATE | FIND "):" > %TEMP%.\~USRINP.CMD
  26.  
  27. REM * Create more temporary batch files. Add
  28. REM * more command line parameters if necessary,
  29. REM * as in: ECHO SET USRINPUT=%%3 %%4 %%5 %%6 %%7 %%8 %%9>CURRENT.CMD
  30. ECHO SET USRINPUT=%%3>CURRENT.CMD
  31.  
  32. REM * VOER.CMD and TYP.CMD are replacements for CURRENT.CMD for Dutch
  33. REM * OS/2 versions; add your own language versions if necessary:
  34. ECHO SET USRINPUT=%%6>VOER.CMD
  35. ECHO SET USRINPUT=%%4>TYP.CMD
  36.  
  37. REM * This temporary batch file now sets the variable USRINPUT:
  38. CALL %TEMP%.\~USRINP.CMD
  39.  
  40. REM * Display the result:
  41. ECHO You typed: %USRINPUT%
  42. ECHO.
  43. PAUSE
  44.  
  45. REM * Finally, clean up the mess of temporary files:
  46. FOR %%A IN (%TEMP%.\~USRINP.CMD %TEMP%.\~USRINP.TMP VOER.CMD TYP.CMD CURRENT.CMD) DO DEL %%A
  47.  

page last modified: 2024-02-26; loaded in 0.0191 seconds