Btach File - Assign Letter B to volume IF diskpart.exe Header Fs equals "Ukno" RRS feed

  • Question

  • Hi,

    I found this bat script below. I would like it to be modified so the script will look at the diskpart.exe header Fs and IF "Unkno" is found then assign letter=B

    I tried to modified it and it doesn't work. I get no errors message or anything.

    Is that possible?

    @echo off
        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!" (
             REM   if not " "=="!letter!" (
                    call :removeVol !letter!
    exit /b
            echo select volume %1
            echo assign letter=B %1
        ) | diskpart
    REM exit /b



    • Edited by vane0326 Sunday, September 17, 2017 2:24 PM
    • Moved by Bill_Stewart Tuesday, November 7, 2017 9:48 PM This is not "fix/debug/rewrite my script for me" forum
    Sunday, September 17, 2017 2:22 PM

All replies