In windows batch file, having a variable %location% where is stored a full path (eg: e:\root_dir\sub1\sub2), how can one extract the full path excluding the drive letter? Result should be stored in a variable and for previous example result would be be\root_dir\sub1\sub2
Asked
Active
Viewed 28 times
0
codiac
- 1,681
- 4
- 16
- 29
1 Answers
0
This should do it:
FOR /F "usebackq tokens=* delims=" %%A IN ('%location%\') DO SET Result=%%~pA
Result of %location% being e:\root_dir\sub1\sub2 would yield %Result% = \root_dir\sub1\sub2\.
Jason Faulkner
- 6,113
- 2
- 26
- 33