Import drive letters for use after reinstall?


Yes. It's a step on the way. I'd prefer this simpler check
:ProcessEachLine
If "%ThisLine:~0,13%"=="\DosDevices\%SystemDrive%" GoTo :EOF
to reduce by one the number of drive letters presented for user intervention.


Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
that is easier, dont you want to get rid of the colon ?

set currentosletter=%systemdrive:~0,-1%

your original script
If "%ThisLine:~0,13%"=="\DosDevices\C" GoTo :EOF
If "%ThisLine:~0,13%"=="\DosDevices\D" GoTo :EOF
If "%ThisLine:~0,13%"=="\DosDevices\E" GoTo :EOF
If "%ThisLine:~0,13%"=="\DosDevices\F" GoTo :EOF
If "%ThisLine:~0,13%"=="\DosDevices\M" GoTo :EOF

could become

If "%ThisLine:~0,13%"=="\DosDevices\%currentosletter%" GoTo :EOF
If "%ThisLine:~0,13%"=="\DosDevices\D" GoTo :EOF
If "%ThisLine:~0,13%"=="\DosDevices\E" GoTo :EOF
If "%ThisLine:~0,13%"=="\DosDevices\F" GoTo :EOF
If "%ThisLine:~0,13%"=="\DosDevices\M" GoTo :EOF
 
Last edited:

My Computers

System One System Two

  • OS
    Win7
    Computer type
    PC/Desktop
    CPU
    i5-8400
    Motherboard
    gigabyte b365m ds3h
    Memory
    2x8gb 3200mhz
    Monitor(s) Displays
    benq gw2480
    PSU
    bequiet pure power 11 400CM
    Cooling
    cryorig m9i
  • Operating System
    win7
    Computer type
    PC/Desktop
    CPU
    pentium g5400
    Motherboard
    gigabyte b365m ds3h
    Memory
    1x8gb 2400
    PSU
    xfx pro 450
"%ThisLine:~0,13%"
does not care about the colon. The variable ends one character before the colon.


All the best,
Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
Oh, it's just occurred to me - when using that syntax to manipulate variables, the count starts at 0 not 1.
That's why "%ThisLine:~0,13%" does not include the colon.


All the best,
Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
Back
Top Bottom