Close, but it's more like this.
for %%p in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if not exist %%p:
ul set FREEDRIVELETTER=%%p
EDIT: Here is a powershell way, not sure if off-topic for your needs
Loops the Upper Case Alphabet
65..90 | foreach {[char]$_;Write-Host "Do Something"}
or Lower Case Alphabet
97..122 | foreach {[char]$_;Write-Host "Do Something"}
Maybe this will work from a batch file.
@ECHO OFF
start /b /wait powershell.exe "97..122 | foreach {$a=[char]$_ ;dir $a:}"
PAUSE
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…