Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for locase.bat

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

  1. @ECHO OFF
  2. SETLOCAL
  3. IF [%1]==[] GOTO Syntax
  4. ECHO %* | FIND "/?" >NUL
  5. IF NOT ERRORLEVEL 1 GOTO Syntax
  6. SET OK=1
  7. FOR %%A IN (%*) DO IF NOT EXIST %%A SET OK=0
  8. IF [%OK%]==[0] GOTO Syntax
  9.  
  10. FOR %%A IN (%*) DO CALL :LoCase1 %%A
  11. GOTO End
  12.  
  13. :LoCase1
  14. FOR %%a IN (%*) DO CALL :LoCase2 %%a
  15. GOTO:EOF
  16.  
  17. :LoCase2
  18. SET filename=%*
  19. VER | FIND "Windows NT" >NUL
  20. IF NOT ERRORLEVEL 1 SET filename=%filename:~1%
  21. SET filename=%filename:A=a%
  22. SET filename=%filename:B=b%
  23. SET filename=%filename:C=c%
  24. SET filename=%filename:D=d%
  25. SET filename=%filename:E=e%
  26. SET filename=%filename:F=f%
  27. SET filename=%filename:G=g%
  28. SET filename=%filename:H=h%
  29. SET filename=%filename:I=i%
  30. SET filename=%filename:J=j%
  31. SET filename=%filename:K=k%
  32. SET filename=%filename:L=l%
  33. SET filename=%filename:M=m%
  34. SET filename=%filename:N=n%
  35. SET filename=%filename:O=o%
  36. SET filename=%filename:P=p%
  37. SET filename=%filename:Q=q%
  38. SET filename=%filename:R=r%
  39. SET filename=%filename:S=s%
  40. SET filename=%filename:T=t%
  41. SET filename=%filename:U=u%
  42. SET filename=%filename:V=v%
  43. SET filename=%filename:W=w%
  44. SET filename=%filename:X=x%
  45. SET filename=%filename:Y=y%
  46. SET filename=%filename:Z=z%
  47. REN %* %filename%
  48. GOTO:EOF
  49.  
  50. :Syntax
  51. ECHO.
  52. ECHO LoCase.bat,  Version 2.00 for Windows NT 4 / 2000
  53. ECHO Rename specified file(s) to all lowercase
  54. ECHO.
  55. ECHO Usage:  LOCASE  ^<filespec^>  [ filespec  [ filespec  [ ... ] ] ]
  56. ECHO.
  57. ECHO Written by Rob van der Woude
  58. ECHO http://www.robvanderwoude.com
  59.  
  60. :End
  61. ENDLOCAL
  62.  

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