Link to home
Start Free TrialLog in
Avatar of gromul
gromul

asked on

Batch file to save current drive letter into a variable

I would like to be able to do something like this: command %driveletter% . Any help is appreciated.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of rage419
rage419

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steve Knight
Or for NT4 I have had to use this as %CD% doesn't work until 2000 (which therefore works on NT/2000/XP/2003):

for /f "tokens=*" %A in ('CD') do set DRIVE=%~dA
Hey.

If you are using XP you can use these:

%Homepath%
%Systemdrive%