DOS <--> NT drive letter conversion 
Author Message
 DOS <--> NT drive letter conversion

From the sound of it, you appear to mean on a multibooting system.
Win9x won't have access to any NTFS drives, and the precise order will
depend on configuration details at the time of installation.

Note that it's pretty easy going the other way, from NT to Win9x
partition.  Drive letters will be ordered by primary partition on each
drive in drive boot order, then will go to each physical drive in boot
order again, and letter all of the logical partitions from each drive in
turn.

--
Please respond in the newsgroup.  I've still got unread email from the
week Win95 was released, if that tells you anything.
http://www.*-*-*.com/
http://www.*-*-*.com/


Quote:
> Given the DOS drive letter, is there any way to determine in a script
> what the NT drive letter is for the same partition?  I've looked and
> it seems to be impossible.



Thu, 16 Dec 2004 22:55:30 GMT  
 DOS <--> NT drive letter conversion
What are you using for the boot manager, anything special? Or the Win2K
Boot loader?

--
Please respond in the newsgroup.  I've still got unread email from the
week Win95 was released, if that tells you anything.
http://www.bittnet.com/winremote
http://www.bittnet.com/scripting


Quote:
> On Sun, 30 Jun 2002 09:55:30 -0500, <Alex K. Angelopoulos (MVP)>

> > From the sound of it, you appear to mean on a multibooting system.

> I do. I have a DOS7.1/Win98/W2k multiboot system.

> > Win9x won't have access to any NTFS drives, and the precise order
will
> > depend on configuration details at the time of installation.

> > Note that it's pretty easy going the other way, from NT to Win9x
> > partition.  Drive letters will be ordered by primary partition on
each
> > drive in drive boot order, then will go to each physical drive in
boot
> > order again, and letter all of the logical partitions from each
drive in
> > turn.

> Easy for you, you mean. :)  I know how to get the file system type for
> each drive but I don't think that's enough to convert to/from the DOS
> drive letter.  What if some drive letters have been moved around with
> disk manager?  The info that would be needed must be in the registry
> somewhere and maybe not in the same place for NT/W2k/XP. I guess the
> easy way is to let the user do the converting, although it would be
> nicer if the script could do it for him.



Fri, 17 Dec 2004 02:21:18 GMT  
 DOS <--> NT drive letter conversion
Starting the process from the Windows 2000 side, it looks like it might
be doable using WMI.  I'm still looking at the details of finding the
actual locations of logical disks (which partition on a drive located on
which channel of which IDE port).  Here's a partial demo of abstracting
some of the information initially.  Basically, any Logical Disk which is
type 3 (meaning a local fixed disk) and has a FAT file system will be
read; so we already can tell which drives will map to something under
Winx9x/DOS, even if we don't yet have the order down.

Here's an example with WMI:

CONST LOCAL_DISK = 3
sHost = "."
Set WmiSvc = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & sHost & "\root\cimv2")
Set Disks = WmiSvc.ExecQuery _
    ("Select * from Win32_LogicalDisk where DriveType=" & LOCAL_DISK)
For Each Disk in Disks
    Wscript.Echo Disk.DeviceID, Disk.DriveType, Disk.FileSystem,
Disk.VolumeSerialNumber
Next

--
Please respond in the newsgroup.  I've still got unread email from the
week Win95 was released, if that tells you anything.
http://www.bittnet.com/winremote
http://www.bittnet.com/scripting


Quote:
> On Sun, 30 Jun 2002 13:21:18 -0500, <Alex K. Angelopoulos (MVP)>

> > What are you using for the boot manager, anything special? Or the
Win2K
> > Boot loader?

> Just the W2k boot loader plus a multi-config config.sys to let me
> choose between DOS and W98.



Fri, 17 Dec 2004 05:56:13 GMT  
 DOS <--> NT drive letter conversion
It's only a start, of course. I was actually trying to figure out how to
do it in Jscript (which I'm not at all used to) and you beat me to it.

I actually posted  a followup in win32.programmer.wmi about determining
the other info we need to complete this.


Quote:
> On Sun, 30 Jun 2002 16:56:13 -0500, <Alex K. Angelopoulos (MVP)>

> Never mind. This seems to do the job. It's a lot of guess work though.

> > var LOCAL_DISK = 3;
> > var sHost = ".";
> > var WmiSvc = GetObject("winmgmts:" +

"{impersonationLevel=impersonate}!\\\\" + sHost + "\\root\\cimv2");
Quote:
> > var Disks = WmiSvc.ExecQuery ("Select * from Win32_LogicalDisk where

DriveType=" + LOCAL_DISK);
Quote:
> > var e = new Enumerator(Disks);
> > for(;!e.atEnd();e.moveNext()){
> > var Disk = e.item();
> > WScript.echo (Disk.DeviceID, Disk.DriveType, Disk.FileSystem,

Disk.VolumeSerialNumber);
Quote:
> > }



Sat, 18 Dec 2004 06:21:05 GMT  
 DOS <--> NT drive letter conversion

Quote:
> That must be a new group. ATT's news server has 22
> microsoft.public.win32.programmer.xxx groups but wmi is not one of
> them.  Does MS still have their own news server?

msnews.microsoft.com

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Sun, 19 Dec 2004 00:31:42 GMT  
 DOS <--> NT drive letter conversion
Microsoft still hosts the newsgroups in its own server farm at
msnews.microsoft.com

If you're connecting to the groups via a Slurped server from your ISP,
your mileage may vary.<g>

Greg Chapman
MS-MVP

http://www.mousetrax.com
MouseTrax Computing Solutions



Quote:

>That must be a new group. ATT's news server has 22
>microsoft.public.win32.programmer.xxx groups but wmi is not one of
>them.  Does MS still have their own news server?



Sun, 19 Dec 2004 00:59:23 GMT  
 DOS <--> NT drive letter conversion
One more step - this one is in VBScript as well; sorry, but I am
definitely *not* multilingual... :(

sHost = "."
LocalDrives = HostDrives(sHost)
For Each LocalDrive in LocalDrives
WScript.Echo LocalDrive, DrivePartition(sHost, LocalDrive)
Next

Function HostDrives(sHost)
 CONST LOCAL_DISK = 3
 Dim WmiSvc, Disks, Disk, aTmp(), i
 Set WmiSvc = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" _
    & sHost & "\root\cimv2")
 Set Disks = WmiSvc.ExecQuery _
   ("Select * from Win32_LogicalDisk where DriveType=" _
   & LOCAL_DISK)
 ReDim aTmp(Disks.Count - 1)
 i = -1
 For Each Disk in Disks
  i = i + 1
   aTmp(i) = Disk.DeviceID
 Next
 HostDrives = aTmp
End Function

Function DrivePartition(sHost, sDrive)
 Dim WmiSvc, Associator, Associators
 Set WmiSvc = GetObject("winmgmts:" _
  & "{impersonationLevel=impersonate}!\\" _
   & sHost & "\root\cimv2")
 Set Associators = WmiSvc.ExecQuery _
  ("Associators of {Win32_LogicalDisk.DeviceID=""" _
  & sDrive & """} WHERE ResultClass=CIM_DiskPartition")
 On Error Resume Next
 For Each Associator in Associators
  DrivePartition = Associator.Name
  If Err.Number <>0 then Err.Clear
 Next
End Function

--
Please respond in the newsgroup.  I've still got unread email from the
week Win95 was released, if that tells you anything.
http://www.bittnet.com/winremote
http://www.bittnet.com/scripting


Quote:

> > It's only a start, of course. I was actually trying to figure out
how to
> > do it in Jscript (which I'm not at all used to) and you beat me to
it.

> It's already better than the GetDrive method because it accesses only
> the HDs and not the floppy with the delay that causes.

> > I actually posted  a followup in win32.programmer.wmi about
determining
> > the other info we need to complete this.

> That must be a new group. ATT's news server has 22
> microsoft.public.win32.programmer.xxx groups but wmi is not one of
> them.  Does MS still have their own news server?



Sun, 19 Dec 2004 09:07:00 GMT  
 DOS <--> NT drive letter conversion

Quote:
> One more step - this one is in VBScript as well; sorry, but I am
> definitely *not* multilingual... :(

Alex, Here's a JScript version...

var sHost = ".";
var n, LocalDrive
var LocalDrives = HostDrives(sHost);

for(n in LocalDrives){
  LocalDrive = LocalDrives[n];
  WScript.Echo(LocalDrive, DrivePartition(sHost, LocalDrive));

Quote:
}

function HostDrives(sHost){
 var LOCAL_DISK = 3;
 var iSvc, Disks, Disk, aTmp, i;
 aTmp = []
 WmiSvc = GetObject("winmgmts:"
   + "{impersonationLevel=impersonate}!\\\\"
   + sHost + "\\root\\cimv2");
 Disks = WmiSvc.ExecQuery
   ("Select * from Win32_LogicalDisk where DriveType="
   + LOCAL_DISK);
 var e = new Enumerator(Disks);
 for(;!e.atEnd();e.moveNext()){
   Disk = e.item();
   aTmp.push(Disk.DeviceID);
 }
 return aTmp;

Quote:
}

function DrivePartition(sHost, sDrive){
 var WmiSvc, Associator, Associators;
 WmiSvc = GetObject("winmgmts:"
   + "{impersonationLevel=impersonate}!\\\\"
   + sHost + "\\root\\cimv2")
 Associators = WmiSvc.ExecQuery
  ("Associators of {Win32_LogicalDisk.DeviceID='"
  + sDrive + "'} WHERE ResultClass=CIM_DiskPartition");
 try{
   var e = new Enumerator(Associators);
   Associator = e.item();
   return Associator.Name;
 }catch(err){return "";}
Quote:
}

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--


Sun, 19 Dec 2004 23:57:59 GMT  
 DOS <--> NT drive letter conversion
I need to work on that.

--
Please respond in the newsgroup.  I've still got unread email from the
week Win95 was released, if that tells you anything.
http://www.bittnet.com/winremote
http://www.bittnet.com/scripting




Quote:
> One more step - this one is in VBScript as well; sorry, but I am
> definitely *not* multilingual... :(

Alex, Here's a JScript version...

var sHost = ".";
var n, LocalDrive
var LocalDrives = HostDrives(sHost);

for(n in LocalDrives){
  LocalDrive = LocalDrives[n];
  WScript.Echo(LocalDrive, DrivePartition(sHost, LocalDrive));

Quote:
}

function HostDrives(sHost){
 var LOCAL_DISK = 3;
 var iSvc, Disks, Disk, aTmp, i;
 aTmp = []
 WmiSvc = GetObject("winmgmts:"
   + "{impersonationLevel=impersonate}!\\\\"
   + sHost + "\\root\\cimv2");
 Disks = WmiSvc.ExecQuery
   ("Select * from Win32_LogicalDisk where DriveType="
   + LOCAL_DISK);
 var e = new Enumerator(Disks);
 for(;!e.atEnd();e.moveNext()){
   Disk = e.item();
   aTmp.push(Disk.DeviceID);
 }
 return aTmp;

Quote:
}

function DrivePartition(sHost, sDrive){
 var WmiSvc, Associator, Associators;
 WmiSvc = GetObject("winmgmts:"
   + "{impersonationLevel=impersonate}!\\\\"
   + sHost + "\\root\\cimv2")
 Associators = WmiSvc.ExecQuery
  ("Associators of {Win32_LogicalDisk.DeviceID='"
  + sDrive + "'} WHERE ResultClass=CIM_DiskPartition");
 try{
   var e = new Enumerator(Associators);
   Associator = e.item();
   return Associator.Name;
 }catch(err){return "";}
Quote:
}

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--


Mon, 20 Dec 2004 02:24:26 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. --------<<<<<<MONEY>>>>>>--------- id 9543

2. Solution: A4 <--> letter

3. <<<< Disabling the ControlBox, MinButton and MaxButton >>>>

4. Win98 user <font color="blue"><B>profiles</B></font>

5. Postscript <-> eexec conversion programs

6. ps <-> gif/jpg/tiff conversion

7. PS <--> EPS conversion

8. ASCII <-> Unicode conversion

9. <<, >> operators to Level 1

10. <pre></pre> problem

11. HPGL<->PostscriptPCL<->Postscript

12. GDSII<->PostScript<->HPGL translation pgms wanted

 

 
Powered by phpBB® Forum Software