Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

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


  • Please log in to reply
57 replies to this topic

#26
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,593 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

From where do i get these informations? Can post them for a handful of languages.

Thank for the script! I tested it and found a tiny bug. If the path to the file contains a space the script breaks up. Just place "" around %~dpnx0


Thanks for the reminder about the quotes: I am so used to use the "right" ;) naming convention of paths without spaces that I always forget about other users habits. :blushing:

Maybe there is no need to make a multilingual check, try this version - where I tried to use actual "places" on lines to get the info.

@ECHO OFFSETLOCAL ENABLEDELAYEDEXPANSIONSETLOCAL ENABLEEXTENSIONSFOR /F "tokens=1 delims=[]" %%A in ('FIND /N "::THIS IS START OF DISKPART BATCH COMMANDS::" "%~dpnx0"') DO SET More_offset=%%AFOR /F "tokens=*" %%A IN ('ECHO list volume^|diskpart^|FIND "Vol"^|FIND "B"') DO (SET LINE=%%ASET token1=!LINE:~7,2!SET token1=!token1: =!IF !token1! lss 10 SET token1=0!token1!SET token2=!LINE:~13,1!SET DP_Vol#!token1!=!token2!)SET DPFOR /F "tokens=2,7"  %%A IN ('ECHO list disk^|diskpart^|FIND "B"') DO SET DP_disks=!DP_disks! %%AFOR %%A IN (%DP_disks%) DO (SET /A DP_Line#=%%A*3+%More_offset%SET /A Counter=0FOR /F "skip=8 tokens=* delims=" %%B IN ('MORE +!DP_Line#! "%~dpnx0"^|diskpart.exe^|FIND /v /i "DISKPART"') DO (Set /A Counter+=1IF !Counter!==1 CALL :Parse_Line DP_disk_sig_%%A %%BIF !Counter!==2 CALL :Parse_Line DP_disk_bus_%%A %%BIF !Counter! GTR 7 CALL :Parse_Line DP_disk_letters_%%A %%B))FOR /F "tokens=2* delims==" %%A IN ('SET DP_disk_letters_') DO SET DP_disk_letters=!DP_disk_letters! %%ASET DP_disk_letters=!DP_disk_letters:  = !SET DP_diskSET ALLDRIVES=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 ZSET BUSYDRV=SET FREEDRV=ECHO.:: List drive letters for physical drivesFOR /F  "tokens=1 delims=\ " %%A IN ('MOUNTVOL /L ^| SORT ^| FIND ":\"') DO SET BUSYDRV=!BUSYDRV! %%A:: List drive letters for network drivesFOR /F "tokens=*" %%A IN ('NET USE ^|FIND ":"') DO (SET This_Drive=%%ASET This_Drive=!This_Drive:~13,1!SET BUSYDRV=!BUSYDRV! !This_Drive!SET NETDRV=!NETDRV! !This_Drive!)SET BUSYDRV=%BUSYDRV::=%:: Check which drive letters aren't used and list them as free drivelettersFOR %%A IN (%ALLDRIVES%) DO (	ECHO.%BUSYDRV% | FIND "%%A">nul	IF ERRORLEVEL 1 (SET FREEDRV=!FREEDRV! %%A:&ECHO %%A: 	FREE) ELSE (ECHO %%A: BUSY)):: Remove leading commaSET FREEDRV=%FREEDRV::=%FOR /F "skip=1 tokens=1 delims=	 " %%A in ('reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum /s ^|find "\"') do (SET ALLDisks=!ALLdisks! %%A)FOR %%A IN (%ALLDISKS%) DO (ECHO.%DP_disks% | FIND " %%A ">nul	IF ERRORLEVEL 1 SET NOT_DP_Disks=!NOT_DP_Disks! %%A)FOR %%A IN (%BUSYDRV%) DO (ECHO.%DP_disk_letters% | FIND " %%A ">nul	IF ERRORLEVEL 1 SET NOT_DP_Drives=!NOT_DP_Drives! %%A)SET NOT_SET BUSYSET FREESET NETGOTO :EOF:Parse_lineSET %1=!%1! %4GOTO :EOF::THIS IS START OF DISKPART BATCH COMMANDS::select disk 0detail diskEXITselect disk 1detail diskEXITselect disk 2detail diskEXITselect disk 3detail diskEXITselect disk 4detail diskEXITselect disk 5detail diskEXITselect disk 6detail diskEXIT



How to remove advertisement from MSFN

#27
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
updated again.

#28
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,593 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
Checking the "mbrfix" version.

Something is simply NOT right.

Preliminary:
the "EXIT" in the first few lines is not a good idea (for people that run the batch from Command Prompt)

first part of the output:
All drive letters:  C D M N O P Q R Y
Mounted drive letters:  C D M N O P Q R
Virtual drive letters:  Y
Internal hard disk 1 drive letter:  C
Internal hard disk 2 drive letter:  D
Internal hard disk 3 drive letter:  {80cf88c6-8a34-11dd-813c-806d6172696f}R {80c
f88c6-8a34-11dd-813c-806d6172696f}R {80cf88c6-8a34-11dd-813c-806d6172696f}R {80c
f88c6-8a34-11dd-813c-806d6172696f}R {80cf88c6-8a34-11dd-813c-806d6172696f}R {80c
f88c6-8a34-11dd-813c-806d6172696f}R {80cf88c6-8a34-11dd-813c-806d6172696f}R {80c
f88c6-8a34-11dd-813c-806d6172696f}R {80cf88c6-8a34-11dd-813c-806d6172696f}R
Cd/dvd rom drive letters:  M
Removalbe drive letters:  N O P Q R
A minor typo:Removalbe->Removable

the call to :vdrv creates havoc, as the %1 is "{80f886-8a34-11dd-813-806d6172696f}R"

Mounted drive letters is NOT sorted and probably cause something queer, or some variable are left after batch competion, on second run:

All drive letters:  C D E F G H I J Y
Mounted drive letters:  C E D F G H I J
Virtual drive letters:  Y
Internal hard disk 1 drive letter:  C
Internal hard disk 2 drive letter:  E
Internal hard disk 3 drive letter:  {80cf88c6-8a34-11dd-813c-806d6172696f}J {80c
f88c6-8a34-11dd-813c-806d6172696f}J {80cf88c6-8a34-11dd-813c-806d6172696f}J {80c
f88c6-8a34-11dd-813c-806d6172696f}J {80cf88c6-8a34-11dd-813c-806d6172696f}J {80c
f88c6-8a34-11dd-813c-806d6172696f}J {80cf88c6-8a34-11dd-813c-806d6172696f}J {80c
f88c6-8a34-11dd-813c-806d6172696f}J {80cf88c6-8a34-11dd-813c-806d6172696f}J
Cd/dvd rom drive letters:  D
Removalbe drive letters:  F G H I J

In :vdrv:
: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
there is something strange, what the heck is ¡ú maybe some "extended characters" of some kind?

The batch continues with a bunch of errors, too many to pinpoint at the moment, then I get this:
ORDERED DRIVE LETTERS:  {80f886-8a34-11dd-813-806d6172696f}Jí·D {80f886-8a34-11d
d-813-806d6172696f}Jí·E {80f886-8a34-11dd-813-806d6172696f}Jí·F {80f886-8a34-11d
d-813-806d6172696f}Jí·G {80f886-8a34-11dd-813-806d6172696f}Jí·H {80f886-8a34-11d
d-813-806d6172696f}Jí·I {80f886-8a34-11dd-813-806d6172696f}Jí·J {80f886-8a34-11d
d-813-806d6172696f}Jí·K {80f886-8a34-11dd-813-806d6172696f}Jí·L Eí·M Dí·N Fí·O G
í·P Hí·Q Ií·R Jí·S

and later on this:
Internal hard disk 3 drive letter:
Usb hard disk 1 drive letters: C
Usb hard disk 2 drive letters: D
Cd/dvd rom drive letters:  M
Removalbe drive letters:  N O P Q R

and later on this:
ORDERED DRIVE LETTERS:  Mí·D Dí·E Ní·F Oí·G Pí·H Qí·I Rí·J

The diskpart version behaves a bit better, but still NOT WORKING (as well with the EXIT REMmed out):
first run:
C:\Downloaded\md5\diskpart>orderdrv_diskpart
"orderdrv_diskpart.cmd" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.
All drive letters:  C D E F G H I J Y
Mounted drive letters:  C E D F G H I J
Virtual drive letters:  Y
Internal hard disk 1 drive letter:  C
Internal hard disk 2 drive letter:  E
Internal hard disk 3 drive letter:
Cd/dvd rom drive letters:  D
Removalbe drive letters:  F G H I J
ORDERED DRIVE LETTERS:  Eí·D Dí·E
Premere un tasto per continuare . . .
!nk! non atteso.


Second run:

C:\Downloaded\md5\diskpart>orderdrv_diskpart
"orderdrv_diskpart.cmd" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
All drive letters: C D E F G H I J Y
Mounted drive letters: C D E F G H I J
Virtual drive letters: Y
Internal hard disk 1 drive letter: C
Internal hard disk 2 drive letter: D
Internal hard disk 3 drive letter:
Cd/dvd rom drive letters: E
Removalbe drive letters: F G H I J
DIRVE LETER ORDER IS CORRECT.
Premere un tasto per continuare . . .
!nk! non atteso.



Again a small typo:
DIRVE LETER ORDER IS CORRECT ->DRIVE LETTER ORDER IS CORRECT

As a reference this is the "right" set of mounted drives on the same machine (using ddlistw.cmd):
C:\VSS>ddlistw3
Drives by drive letter:
c: 0,1 FIX \Volume{b0b284c3-8a33-11dd-8781-806d6172696f} \HarddiskVolume1
d: 1,1 FIX \Volume{b0b284c4-8a33-11dd-8781-806d6172696f} \HarddiskVolume2
e: x,x CDR \Volume{80cf88c2-8a34-11dd-813c-806d6172696f} \CdRom0
f: 2,1 REM \Volume{5d3e8800-9c1f-11dd-8148-001fc6bb76ce} \Harddisk2\DP(1)0-0+5
g: 3,1 REM \Volume{80cf88c3-8a34-11dd-813c-806d6172696f} \Harddisk3\DP(1)0-0+a
h: 4,1 REM \Volume{80cf88c4-8a34-11dd-813c-806d6172696f} \Harddisk4\DP(1)0-0+b
i: 5,1 REM \Volume{80cf88c5-8a34-11dd-813c-806d6172696f} \Harddisk5\DP(1)0-0+c
j: 6,1 REM \Volume{80cf88c6-8a34-11dd-813c-806d6172696f} \Harddisk6\DP(1)0-0+d
Premere un tasto per continuare . . .

Drives by connection:
c: 0,1 FIX \Volume{b0b284c3-8a33-11dd-8781-806d6172696f} \HarddiskVolume1
d: 1,1 FIX \Volume{b0b284c4-8a33-11dd-8781-806d6172696f} \HarddiskVolume2
f: 2,1 REM \Volume{5d3e8800-9c1f-11dd-8148-001fc6bb76ce} \Harddisk2\DP(1)0-0+5
g: 3,1 REM \Volume{80cf88c3-8a34-11dd-813c-806d6172696f} \Harddisk3\DP(1)0-0+a
h: 4,1 REM \Volume{80cf88c4-8a34-11dd-813c-806d6172696f} \Harddisk4\DP(1)0-0+b
i: 5,1 REM \Volume{80cf88c5-8a34-11dd-813c-806d6172696f} \Harddisk5\DP(1)0-0+c
j: 6,1 REM \Volume{80cf88c6-8a34-11dd-813c-806d6172696f} \Harddisk6\DP(1)0-0+d
e: x,x CDR \Volume{80cf88c2-8a34-11dd-813c-806d6172696f} \CdRom0

:unsure:

jaclaz

#29
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
Hi, Jaclaz.

Thanks for your feed back first.

The strange letter ¡ú is "→" I don't know if you can recognize it in IE.

Do send me your registry value of "HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices". I must make a through check.

I have to point out that the drive letter order of a fixed hard disk is obtained by their volume offsets size ascendingly.

":sort" is the compare procedure, btw, IF command can compare hex values.

#30
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
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).

#31
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,593 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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

Attached Files



#32
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
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.

#33
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,546 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

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!

#34
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
I have no win2k system to check, if you can, let me know result.

#35
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,593 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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

Attached Files



#36
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,546 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

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!

#37
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
Hi, above.

You are right, it is my fault, the batches don't fit for WIN2K system.

#38
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
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!

#39
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,593 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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.re.../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/...o...24539&st=11
;)

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

:lol:

jaclaz

#40
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
Jaclaz is an odd guy.
My English is poor.
Tonight I will give revised version.

#41
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,546 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

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

::get all drive letterswmic /? >nul 2>&1if 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)
Posted Image

#42
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
That line is used for win pe to get all drive letters from registry.

#43
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
Jaclaz try new version again.

#44
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,546 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator


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.

#45
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,593 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
@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

#46
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
@Jaclaz

I am really glad that you such an expert to test my batch again and again.

The !NK! problem I should check again.
The diskpart version, I have to say, for multidisk system, diskpart runs slow evern some times hangs.

When I have time I will make further update. Thank you very much.

Edited by victor888, 18 August 2009 - 07:36 AM.


#47
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,546 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Thanks for the acknowledgement of my post…

Here is the registry export from a test machine using WinPE
(Reg Export HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2 output.reg)

output.reg
Windows Registry Editor Version 5.00[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2][HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\A]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\B]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\C]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\D]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\E]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\X]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\Y]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{5932c341-8515-11de-9904-806e6f6e6963}]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{5932c344-8515-11de-9904-806e6f6e6963}]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{5932c345-8515-11de-9904-806e6f6e6963}]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{5932c348-8515-11de-9904-806e6f6e6963}]"BaseClass"="Drive"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}]"BaseClass"="Drive"
It follows therefore that the script line I previously asked about will once again return nothing!

…explain please!

#48
victor888

victor888

    Member

  • Member
  • PipPip
  • 155 posts
  • Joined 20-October 04
Above

I don't know how to explain it to you. What you need to do is just run the batch under pe, then you could understand everything. Certainly, the some lines under the line you asked also tell what is what.

I have to say, my batches have been donloaded and tested by many many people, exceplt Jaclaz last bug feedback, no bug reported. Here is the reference: http://bbs.wuyou.com.....;extra=page=4

#49
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,546 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

I've got to be honest here, considering you wrote the code, you're not really helping me much if you cannot explain to me what your intention was for output from a command within it!

Your code is looking for \\2 in those subkeys of the mountpoints2 branch. As you can see from both a booted system and a PE environment there is no string using a double backslash never mind one with a 2 followed by one.

Since it appears that the registry read is included to replicate the results obtained from the wmic command when that is not available, I expect it to return similar output to that wmic command.

Here's a thought! (based purely on my understanding and the result of my real world test with my WinPE disk)
If you were to change the Find command within the for to read this:
adv=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\AHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\BHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\CHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\DHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\EHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\XHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\YHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{5932c341-8515-11de-9904-806e6f6e6963}HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{5932c344-8515-11de-9904-806e6f6e6963}HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{5932c345-8515-11de-9904-806e6f6e6963}HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{5932c348-8515-11de-9904-806e6f6e6963}HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\{d9b257fc-684e-4dcb-ab79-03cfa2f6b750}adv:~-2=\A\B\C\D\E\X\Y3}3}3}3}0}adv:~,1=\\\\\\\33330adv~-1=ABCDEXY

The resulting ALLDRV variable in that scenario would be:
 A B C D E X Y

So since you were unable to explain, and all I have to go from is this statement:

For PE, all drive letters are find from registry

and this (unuseful to an English speaker) information:
Posted Image
I have attempted to show you myself!

Therefore:
  • Is your code wrong?
  • Is your code written only for a particular version of WinPE (not mine - Vista based)?
  • Are my systems broken?
  • Do I need to learn batch programming?
  • Am I just wrong?

Please…

#50
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,593 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

  • Is your code written only for a particular version of WinPE (not mine - Vista based)?


OT, but not much, at least initially, we were talking about PE 1.x (XP/2003 based) as opposed to PE 2.x (Vista/2008based) or PE 3.x (Windows 7 based). :unsure:

It should always be specified as different versions of PE's are not "the same".

jaclaz




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users