I have a batch file which is on a usb key. I need to know the drive name the batch is in.
Example, if it\'s E:\\mybatch.bat it should find E:\\ same thing for F:\\, G:\\
%CD:~0,2%
This will give you the current drive in the format C: , i.e. first 2 chars from the current working directory
C:
C:\Users\ashish>ECHO %CD:~0,2% C: D:\projects>ECHO %CD:~0,2% D: D:\projects>ECHO %CD% D:\projects