My programming skills are very weak and I'm trying to modify this script below that I got it from here.
The script should look into the header Fs and IF "unKno" is found then assign Letter=B
I know their are other ways you can point to a text file with the diskpart command but I would like to avoid that. I would like (if possible) to have it done without using texts files.
Is this possible?
@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
for /f "delims=" %%i in ('^
echo list volume ^|^
diskpart ^|^
findstr Volume ^|^
findstr /v ^
/c:"Volume ### Ltr Label Fs Type Size Status Info"^
') do (
set "line=%%i"
set letter=!line:~15,1!
set fs=!line:~32,5!
if not "Unkno"=="!fs!" (
if not " "=="!letter!" (
call :removeVol !letter!
)
)
)
endlocal
exit /b
:removeVol
(
echo select volume %1
echo assign letter=B %1
) | diskpart
exit /b