Powered by GeSHi

Source code for curdrive.bat

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

  1. @ECHO OFF
  2. :: CURDRIVE.BAT
  3. :: Written by Rob van der Woude
  4. :: Places the current drive letter in environment variable CURRDRIVE
  5. ::
  6. SET CURDRIVE=
  7. CD | CHOICE /C:ABCDEFGHIJKLMNOPQRSTUVWXYZ > NUL
  8. IF ERRORLEVEL  1 SET CURDRIVE=A
  9. IF ERRORLEVEL  2 SET CURDRIVE=B
  10. IF ERRORLEVEL  3 SET CURDRIVE=C
  11. IF ERRORLEVEL  4 SET CURDRIVE=D
  12. IF ERRORLEVEL  5 SET CURDRIVE=E
  13. IF ERRORLEVEL  6 SET CURDRIVE=F
  14. IF ERRORLEVEL  7 SET CURDRIVE=G
  15. IF ERRORLEVEL  8 SET CURDRIVE=H
  16. IF ERRORLEVEL  9 SET CURDRIVE=I
  17. IF ERRORLEVEL 10 SET CURDRIVE=J
  18. IF ERRORLEVEL 11 SET CURDRIVE=K
  19. IF ERRORLEVEL 12 SET CURDRIVE=L
  20. IF ERRORLEVEL 13 SET CURDRIVE=M
  21. IF ERRORLEVEL 14 SET CURDRIVE=N
  22. IF ERRORLEVEL 15 SET CURDRIVE=O
  23. IF ERRORLEVEL 16 SET CURDRIVE=P
  24. IF ERRORLEVEL 17 SET CURDRIVE=Q
  25. IF ERRORLEVEL 18 SET CURDRIVE=R
  26. IF ERRORLEVEL 19 SET CURDRIVE=S
  27. IF ERRORLEVEL 20 SET CURDRIVE=T
  28. IF ERRORLEVEL 21 SET CURDRIVE=U
  29. IF ERRORLEVEL 22 SET CURDRIVE=V
  30. IF ERRORLEVEL 23 SET CURDRIVE=W
  31. IF ERRORLEVEL 24 SET CURDRIVE=X
  32. IF ERRORLEVEL 25 SET CURDRIVE=Y
  33. IF ERRORLEVEL 26 SET CURDRIVE=Z
  34. IF     "%CURDRIVE%"=="" ECHO Error checking current drive
  35. IF NOT "%CURDRIVE%"=="" ECHO Current drive is %CURDRIVE%:
  36.