Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for upcase.bat

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

  1. @ECHO OFF
  2. SETLOCAL
  3. IF [%1]==[] GOTO Syntax
  4. TYPE %* | 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 :UpCase1 %%A
  11. GOTO End
  12.  
  13. :UpCase1
  14. FOR %%a IN (%*) DO CALL :UpCase2 %%a
  15. GOTO:EOF
  16.  
  17. :UpCase2
  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 UpCase.bat,  Version 2.00 for Windows NT 4 / 2000
  53. ECHO Rename specified file(s) to all uppercase
  54. ECHO.
  55. ECHO Usage:  UPCASE  ^<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 modified: 2024-04-16; loaded in 0.0076 seconds