Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for random.bat

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

  1. @ECHO OFF
  2. ECHO.
  3. IF NOT [%1]==[] GOTO Syntax
  4.  
  5. :: Change the FIND string and the tokens/delims
  6. :: parameters for non-US language and settings:
  7. FOR /F "tokens=2 delims=." %%A IN ('VER ^| TIME ^| FIND "current"') DO SET Random=%%A
  8. SET Random
  9. GOTO End
  10.  
  11. :Syntax
  12. ECHO Random, Version 1.00 for Windows NT
  13. ECHO Generate a semi-random number between 0 and 99 by "capturing"
  14. ECHO the hundredths of seconds of the execution time.
  15. ECHO.
  16. ECHO Written by Rob van der Woude
  17. ECHO http://www.robvanderwoude.com
  18. ECHO.
  19. ECHO Usage:  %~n0
  20. ECHO.
  21. ECHO Note :  Written for US version of Windows NT 4
  22. ECHO         with standard US International settings.
  23. ECHO         Adjust the parameters of the FOR and FIND commands
  24. ECHO         for other languages and International settings.
  25.  
  26. :End
  27.  

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