Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 



victor888

[Updated on Feb. 27. 2011] ordering messed drive letter batch file

Recommended Posts

jaclaz    943
Jaclaz

Though long time past since I have written above post, I think the problem you pointed out over and over. Finally, I think the problem comes from your ITALIAN xp system that is because of different system code.

I found a strang letter from your feedback too--"Jí". I don't know what it is.

I hope for a long time and again you could give your registry value of "HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices" for me to check.

My batch files have been downloaded by many Chinese and no bugs emerge since my last revision (same as here attached).

Sorry Victor, I completely forgot.

Find attached:

the output of ddlistw on my system "as is now" (which is different from last report)

the exported MountedDevices

the output of the MBRFIX version

the output of the DISKPART version

Apart from the problem reported, you SHOULD NOT allow the batch to actually attempt reordering drive letters WITHOUT and explicit confirmation by the user.

Using the batch as is may botch the setup of an unexperienced user.

It happened to my system, though of course I know how to fix it.

In this:

::two founds with using batch file

::1. "?"¡¡can not be as an element of string in the for command

::2. one variable can not contain another varable in for command i.e. for %%a in (!ab%c%!) do ..., !ab%c%! has no value

the ¡¡ are A1A1 hex

:vdrv

set nk=!fulldrv:~%k%,1!

if /i %1 neq !nk! (

set ordereddrv=!ordereddrv! %1¡ú!nk!

mountvol %1: /d

set viddrv=!viddrv! !totalvid:~%e%,38!!nk!

)

goto :eof

the ¡ú are A1FA hex

jaclaz

report.zip

Share this post


Link to post
Share on other sites

victor888    0

Hi, Jaclaz

I am sure there something strange in your registry:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum, where a unrecognizable disk exist.

So do include here your this registry values.

Share this post


Link to post
Share on other sites
Yzöwl    30
This batch work under winpe and winnt systems(2k,2k3,xp,vista)

Your code appears to completely ignore Windows 2000.

You only supply mountvol executables for 2k3, xp and vista, but I'm sure that 2k doesn't work with later versions of mountvol and there's no check for Reg.exe which is not by default part of the Windows 2000 OS!

Share this post


Link to post
Share on other sites
jaclaz    943
Hi, Jaclaz

I am sure there something strange in your registry:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum, where a unrecognizable disk exist.

So do include here your this registry values.

Rest assured that there is NOTHING "strange" in my Registry :w00t:, and particularly NOT in HKLM\\SYSTEM\CurrentControlSet\Services\Disk\Enum. ;)

However, find attached the relevant exported key. :)

jaclaz

jaclaz_services_disk_enum.zip

Share this post


Link to post
Share on other sites
Yzöwl    30
I have no win2k system to check, if you can, let me know result.
There will be no result, without a version of reg.exe which uses the syntax used in your script; or access to the correct version of mountvol.exe your script will not work on Windows 2000!

Share this post


Link to post
Share on other sites
victor888    0

Hi, Jaclaz

My suspiiion is right, your HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum has a strange value---"2"="SCSI\\Disk&Ven_Perisoft&Prod_Virtual_Disk&Rev_0001\\1&2afd7d61&1&000", a virtual disk which has no sigcode and can't be displayed by diskpart.

To meet this special situation, I have to revise my code again. Please wait for a short time.

Thank you for testing it!

Share this post


Link to post
Share on other sites
jaclaz    943
My suspiiion is right, your HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum has a strange value---"2"="SCSI\\Disk&Ven_Perisoft&Prod_Virtual_Disk&Rev_0001\\1&2afd7d61&1&000", a virtual disk which has no sigcode and can't be displayed by diskpart.

It's not "strange":

http://dictionary.reference.com/browse/strange

, in the sense of

4. outside of one's previous experience; hitherto unknown; unfamiliar: strange faces; strange customs.

Looky here :whistle::

http://www.msfn.org/board/index.php?showto...24539&st=11

;)

I actually "introduced" it at the time in order to have a "particular" situation.....

:lol:

jaclaz

Share this post


Link to post
Share on other sites
Yzöwl    30

Just a quick question, what is the REG QUERY line in the below section supposed to produce?

::get all drive letters
wmic /? >nul 2>&1
if errorlevel 1 (
for /f "tokens=1 delims= " %%a in ('REG QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\ /s ^|find "2\\"') do (
set adv=%%a
set adv=!adv:~-3!
set tdv=!adv:~0,2!
if !tdv! equ \\ (
set adv=!adv:~-1!
set ALLDRV=!ALLDRV! !adv!
)
)
) else (
for /f "skip=1" %%a in ('wmic logicaldisk get caption') do (
set adv=%%a
set ALLDRV=!ALLDRV! !adv!
)
)
set ALLDRV=%ALLDRV::=%

echo All drive letters: %ALLDRV%

I do confess I haven't tried to find out from checking all the code, my expectation however was that it would produce a listing the same or similar to the WMIC command.

My system doesn't output anything for the REG QUERY hence my question. (see image of output)

thumb-52F3_4A7873AB.jpg

Share this post


Link to post
Share on other sites
Yzöwl    30

Just a quick question, what is the REG QUERY line in the below section supposed to produce?

<snip />

That line is used for win pe to get all drive letters from registry.

Re-worded:

Could you please provide me with a sample of the output from the following command, (when run in the appropriate context), in order for me to assess what is produced.

REG QUERY HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\ /s |find "2\\"

Thank you.

Share this post


Link to post
Share on other sites
jaclaz    943

@victor888

MUCH better! :)

the mbrfix one:

All drive letters: C D E F G H I M P W

Mounted drive letters: C D P G W M E F H I

Internal hard disk 1 drive letter: C

Internal hard disk 2 drive letter: D

Cd/dvd rom drive letters: P G

Removable drive letters: W M E F H I

DRIVE LETTERS to be ordered: P to E, G to F, W to G, M to H, E to I, F to J, H

to K, I to L,

Are you sure to make above drive letter changes (Y/N)n

Drive letter changing canceled by user

Premere un tasto per continuare . . .

With some "strange setup" (not the one shown above) from time to time I get a:

!nk! was not expected

:

C:\Downloaded\md5\mbrfix>orderdrv_mbrfix.cmd

All drive letters: C D F G L M P Y

Mounted drive letters: C D P G L M

Virtual drive letters: F Y

Internal hard disk 1 drive letter: C

Internal hard disk 2 drive letter: D

Cd/dvd rom drive letters: P G

Removable drive letters: L M

DRIVE LETTERS to be ordered: P to E, L to H, M to I,

Are you sure to make above drive letter changes (Y/N)n

Drive letter changing canceled by user

Premere un tasto per continuare . . .

!nk! non atteso.

the diskpart version "hangs" from time to time, if re-used several times (possibly a timing problem), right now is stuck, so I cannnot produce an output of it right now, this is the output of the "previous" setup:

C:\Downloaded\md5\diskpart>orderdrv_diskpart

All drive letters: C D F G L M P Y

Mounted drive letters: C D P G L M

Virtual drive letters: F Y

Internal hard disk 1 drive letter: C

Internal hard disk 2 drive letter: D

Cd/dvd rom drive letters: P G

Removable drive letters: L M

DRIVE LETTERS to be ordered: P to E, L to H, M to I,

Are you sure to make above drive letter changes (Y/N)n

Drive letter changing canceled by user

Premere un tasto per continuare . . .

If I may :unsure:

Besides the final "!nk! was not expected", a few remarks, of course just as some small advice in order to better the thingies:

the Y in "Virtual drive Letters" is actually a network mapped drive, any way to differentiate it?

"All drive letters:" is SORTed

"Mounted drive letters:" is NOT SORTed

"Cd/dvd rom drive letters:" is NOT SORTed

it is more intuitive to see them in alphabetical order

more generally, a columnar output for the re-mapping would be more readable, i.e. instead of:

DRIVE LETTERS to be ordered: P to E, G to F, W to G, M to H, E to I, F to J, H

to K, I to L,

this would seem to me more readable:

DRIVE LETTERS to be ordered:

P to E

G to F

W to G

M to H

E to I

F to J

H to K

I to L

:unsure:

Thanks for the update.

jaclaz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×