MSFN Forum: [Updated on Feb. 27. 2011] ordering messed drive letter batch file - MSFN Forum

Jump to content


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

[Updated on Feb. 27. 2011] ordering messed drive letter batch file Getting whole drive letter information from registry.

#41 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 04 August 2009 - 11:46 AM

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)
Posted Image


#42 User is offline   victor888 

  • Member
  • PipPip
  • Group: Members
  • Posts: 155
  • Joined: 20-October 04

Posted 04 August 2009 - 10:40 PM

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

#43 User is offline   victor888 

  • Member
  • PipPip
  • Group: Members
  • Posts: 155
  • Joined: 20-October 04

Posted 05 August 2009 - 09:32 PM

Jaclaz try new version again.

#44 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 07 August 2009 - 12:47 PM

View Postvictor888, on Aug 5 2009, 05:40 AM, said:

View PostYzöwl, on Aug 4 2009, 06:46 PM, said:

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 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,458
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 08 August 2009 - 04:41 AM

@victor888

MUCH better! :)

the mbrfix one:

Quote

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
:

Quote

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:

Quote

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:

Quote

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:

Quote

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 User is offline   victor888 

  • Member
  • PipPip
  • Group: Members
  • Posts: 155
  • Joined: 20-October 04

Posted 08 August 2009 - 09:59 PM

@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.

This post has been edited by victor888: 18 August 2009 - 07:36 AM


#47 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 09 August 2009 - 02:23 AM

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 User is offline   victor888 

  • Member
  • PipPip
  • Group: Members
  • Posts: 155
  • Joined: 20-October 04

Posted 09 August 2009 - 06:08 PM

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/viewthread.php?tid=13...;extra=page%3D4

#49 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 10 August 2009 - 06:51 AM

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\A
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\B
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\C
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\D
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\E
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\X
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\Y
HKEY_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
\Y
3}
3}
3}
3}
0}

adv:~,1=
\
\
\
\
\
\
\
3
3
3
3
0

adv~-1=
A
B
C
D
E
X
Y 


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:

View Postvictor888, on Nov 14 2008, 04:23 AM, said:

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 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,458
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 11 August 2009 - 05:30 AM

View PostYzöwl, on Aug 10 2009, 02:51 PM, said:

  • 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

#51 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 11 August 2009 - 06:31 AM

I see so you're updating batch files for an OS which is two generations out of date…

(it does make me wonder what real use including the following is)
ver |find " 6.0">nul &&set TheOS=Vista
<snip>
  if !TheOS! equ Vista set mfile=mountvol_vs.exe


My WinPE 3.0 disk doesn't even contain a MountPoints2 registry branch, in fact the only place I can find my drives mentioned in the registry is here: HKLM\SYSTEM\MountedDevices.

#52 User is online   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,458
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 11 August 2009 - 12:45 PM

View PostYzöwl, on Aug 11 2009, 02:31 PM, said:

I see so you're updating batch files for an OS which is two generations out of date…


Well, personally, I am THREE generations out of date. :w00t:

I thought that using batch files in itself was a declaration in that sense of self-evident relevance. :unsure:

My remark was, as said, sligthly OT and a "general" kind of advice, I have no idea what victor888's intentions are, were or will be. :blushing:

:hello:

jaclaz

#53 User is offline   victor888 

  • Member
  • PipPip
  • Group: Members
  • Posts: 155
  • Joined: 20-October 04

Posted 12 August 2009 - 06:14 PM

It is my fault that the batch doesn't consider the PE2.X or PE3.X, only ofr PE 1.0.

Pe is only used for maintenance, I think, PE1.X is enough.

#54 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,364
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 12 August 2009 - 10:27 PM

View Postvictor888, on Aug 13 2009, 01:14 AM, said:

It is my fault that the batch doesn't consider the PE2.X or PE3.X, only ofr PE 1.0.

Pe is only used for maintenance, I think, PE1.X is enough.
Since PE is supplied for deployment of Windows, and PE 1.x isn't created for deploying Vista, and you provided code for that OS, then I suppose that the fault lies squarely with you!

#55 User is offline   victor888 

  • Member
  • PipPip
  • Group: Members
  • Posts: 155
  • Joined: 20-October 04

Posted 15 January 2011 - 10:53 PM

Update again, hope somebody like it.

#56 User is offline   zj840605 

  • Group: Members
  • Posts: 1
  • Joined: 31-August 11
  • OS:none specified
  • Country: Country Flag

Posted 31 August 2011 - 10:44 PM

国内下载不到~ 所以跑这里来了

#57 User is offline   ilko_t 

  • MSFN Addict
  • Group: Super Moderator
  • Posts: 1,605
  • Joined: 06-December 06
  • OS:none specified
  • Country: Country Flag

Posted 07 September 2011 - 02:18 PM

View Postzj840605, on 31 August 2011 - 10:44 PM, said:

国内下载不到~ 所以跑这里来了
This is English speaking forum, please post only in English.

#58 User is offline   zamarac 

  • Newbie
  • Group: Members
  • Posts: 23
  • Joined: 07-April 09

Posted 18 January 2012 - 05:22 PM

Sorry for my ignorance, which one of the above batches can list unmounted in Win7 volume numbers on a selected attached disk? If none, can someone offer modification here? :wacko:

This post has been edited by zamarac: 18 January 2012 - 05:23 PM


Share this topic:


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy