extract 2 characters from a dos variable

April 9, 2010 at 05:47:17
Specs: Windows XP
I have the following script:
@echo off
vol c:>C:\ServerBU\testfile.txt
set /p voldrive=<"C:\ServerBU\testfile.txt"

The output is as followes:
Volume in drive C has no label.

I need to make a variable using "drive C"
thank you in advanse


See More: extract 2 characters from a dos variable

Report •

#1
April 9, 2010 at 21:58:35
Extract 2 characters? Which two?

This will extract "drive C"

set var=%voldrive:~11,7%


Report •

#2
April 10, 2010 at 09:36:45
Thanks so much, it worked great!

Report •
Related Solutions


Ask Question