I need to get the drive letter of the usb pen drive.the command CHDIR >drive.txt gives me the drive letter L:.How do I read/get this info \"L:\" without quotes into a variab
Since cd will output something like:
c:\documents and settings\pax
you need to just grab the first field using "\" as the delimiter as follows:
for /f "delims=\" %d in ('cd') do set curdrv=%d
This will set the environment variable curdrv to c: for the aforementioned output.
Don't forget to use the double-% (%%d) variant if running inside a cmd file.