victor888 Posted September 27, 2008 Posted September 27, 2008 (edited) No matter which partition you installed your xp to by usb_multiboot_10, just run it, the drive letters will be ordered correctly. just add the batch code in undoren.cmd you don't affraid the drive letter shifting when installing xp using usb hard disk. Certainly, it is no need to change migrate.inf when installing xp using usb stick, thus we need change usb_multiboo_10.cmd, do it yourself.===batch content:SETLOCAL ENABLEEXTENSIONSSETLOCAL ENABLEDELAYEDEXPANSION::get fixed drivesecho list disk >listdisk.txtdiskpart /s listdisk.txt >listresult.txtfor /f "skip=8 tokens=2 delims= " %%a in (listresult.txt) do ( echo select disk %%a >selectdisk%%a.txt echo detail disk >>selectdisk%%a.txt diskpart /s selectdisk%%a.txt >detaildisk%%a.txt for /f "tokens=3 skip=17" %%b in (detaildisk%%a.txt) do ( echo %%b: >>fix.txt )del selectdisk%%a.txtdel detaildisk%%a.txt)del listdisk.txtdel listresult.txt::get CDROM and removeable drivesFOR /F "tokens=*" %%a in ('fsutil fsinfo drives ^| FIND /V ""') DO ( set dr=%%a SET dr=!dr:~-3,3! SET cdr=!dr:~0,1! IF !cdr! GTR B ( FOR /F "tokens=1 delims= " %%P IN ('fsutil fsinfo drivetype !dr! ^| FIND "CD-ROM"') DO ( SET vname=%%P SET vname=!vname:~0,2! echo !vname! >>CDROM.txt ) FOR /F "tokens=1 delims= " %%P IN ('fsutil fsinfo drivetype !dr! ^| FIND /i "removable"') DO ( SET vname=%%P SET vname=!vname:~0,2! echo !vname! >>remove.txt ) )):: ording vidfor %%a in (fix.txt CDROM.txt remove.txt) do ( if exist %%a ( for /f %%b in (%%a) do ( IF %%b neq %systemdrive% ( mountvol %%b /l >drive.txt mountvol %%b /d for /f %%c in (drive.txt) do ( set vid=%%c echo !vid! >>vid.txt ) ) ) ))for %%d in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do ( if %%d: neq %systemdrive% ( echo %%d >>drv.txt ))if exist "fix.txt" del fix.txtif exist "cdrom.txt" del cdrom.txtif exist "remove.txt" del remove.txtfor /f "tokens=*" %%a in (vid.txt) do ( set /a n+=1 set _!n!=%%a)set n=0for /f "tokens=*" %%i in (drv.txt) do call :lp %%ifor /f "tokens=1,2 delims= " %%a in ('findstr "\\" c.txt') do mountvol %%b: %%adel drv.txtdel vid.txtdel drive.txtdel c.txtexit:lpset /a n+=1echo !_%n%!%1>>c.txt ===below is originalAfter installing XP from USB hard disk, the drive D letter is for USB hard disk's first partition, while E F G ... is the first hard disk's second, third, fourth ... drive letter respectively. We need such drive order: C D E F drive letter belongs to the first hard disk, and G belongs to the USB hard disk.These two files just do the job.No prolem, its safe.the content of drivechange.cmdECHO Program - DRVCHANG.CMD - 26 Sep 2008 - Date = %DATE% %TIME:~0,8%CLSrem SETLOCAL ENABLEEXTENSIONSSETLOCAL ENABLEDELAYEDEXPANSIONSET USBDRIVE=SET TAGFILE=\usbflashFOR %%h IN (C D E F G H I J K L M N O P Q R S T U V W X Y) DO IF EXIST "%%h:%TAGFILE%" SET USBDRIVE=%%h:echo select disk 0 >selectdisk.txtecho detail disk >>selectdisk.txtdiskpart /s selectdisk.txt >detaildisk.txtecho %usbdrive:~0,1% >drv.txtfor /f "tokens=3 skip=18" %%a in (detaildisk.txt) do ( set drv=%%a echo !drv! >>drv.txt mountvol %%a: /l >drive.txt for /f %%b in (drive.txt) do ( set vid=%%b echo !vid! >>vid.txt ))mountvol %usbdrive% /l >drive.txtfor /f %%c in (drive.txt) do set vid=%%cecho %vid% >>vid.txtcall c.cmddel selectdisk.txtdel detaildisk.txtdel drive.txtdel drv.txtdel vid.txtfor /f "tokens=2 delims= " %%a in (c.txt) do mountvol %%a: /dfor /f "tokens=1,2 delims= " %%a in (c.txt) do mountvol %%b: %%adel c.txtEXITthe content of c.cmd@offsetlocal enabledelayedexpansionif exist c.txt del /q c.txtfor /f "tokens=*" %%a in (vid.txt) do (set /a n+=1set _!n!=%%a)set n=0for /f "tokens=*" %%i in (drv.txt) do call :lp %%igoto :eof:lpset /a n+=1echo !_%n%!%1>>c.txtso, we can revise undoren.cmd and add above code and c.cmd file, drive leter will rearranged corrcetly after first logon.I hope you can optimize two files in one.orderdrv2.rar Edited October 5, 2008 by victor888
wimb Posted September 27, 2008 Posted September 27, 2008 The idea to use mountvol for rearranging the Drive Letters is interesting.I have not yet used your batch files, but it seems to me that using disk 0 can be incorrect in case your computer has e.g. two internal harddisks and you are installing on harrdisk 1 echo select disk 0 >selectdisk.txtBut in any way it will be interesting to implement and further improve the idea.
victor888 Posted September 27, 2008 Author Posted September 27, 2008 yes, I have considered this question. My main purpose the batch files are used for usb_multiboot10,so,most time xp is installed on the first hard disk.As for on the second HD or more, the HD should be selected according to %home drive%.
wimb Posted September 27, 2008 Posted September 27, 2008 (edited) you must first determine the harddisk nr of your %homedrive% using diskpart.But that is not sufficient, in fact all local harddisks are involved in rearranging drive letters. Edited September 27, 2008 by wimb
victor888 Posted September 27, 2008 Author Posted September 27, 2008 There are should be no more difficulties.We can give internal hard disks ordered drive letters and usb disk at last.So, need more test and revising, wimb help.
jaclaz Posted October 5, 2008 Posted October 5, 2008 If I may , it would be advisable to directly use the output of the commands, as to avoid the unneeded creation of some temporary files.As an example this:diskpart /s listdisk.txt >listresult.txtfor /f "skip=8 tokens=2 delims= " %%a in (listresult.txt) do (can be "simplified" to:for /f "skip=8 tokens=2 delims= " %%a in ('diskpart /s listdisk.txt') do (And diskpart can be "fed" with commands, this:echo list disk >listdisk.txtdiskpart /s listdisk.txtcan be obtained by:echo list disk|diskpart.exeThus, overall, the whole:echo list disk >listdisk.txtdiskpart /s listdisk.txt >listresult.txtfor /f "skip=8 tokens=2 delims= " %%a in (listresult.txt) do (can become:for /f "skip=8 tokens=2 delims= " %%a in ('echo list disk^|diskpart.exe') do (with two temporary files less.jaclaz
victor888 Posted October 5, 2008 Author Posted October 5, 2008 Many thanks to Jaclaz, hope you could optimiz it more.Next I will revise it and make it fit for PE and normal installed xp.Yet there is really a trouble thing, it is difficult to get the drive letters of two or more usb disks. If just one exist I can use tag file on it and use diskpart to get its drive letters.This time I have to consider the influnce of virtual disk such as created by virtutal cd soft, subst and net use commands.
jaclaz Posted October 5, 2008 Posted October 5, 2008 This time I have to consider the influnce of virtual disk such as created by virtutal cd soft, subst and net use commands.You are welcome to use/copy/modify, if useful, my small batches here:http://www.911cd.net/forums//index.php?sho...=21965&st=6I am attaching a copy here also, should you have troubles in getting them from 911CD. jaclazFreedrv.zip
Rich_Weiss Posted June 4, 2009 Posted June 4, 2009 Is there a way to tweak this so it will map the disk type groupings to a certain range of drive letters rather than one drive letter after the other? I would like to have the first CD/DVD drive map to drive R: and the next to S: etc. and the removable drives to end at drive Z:. For ExampleC: Local System DriveD: Local Data DriveN: Network DriveR: CD ROMS: DVD ROMX: Removable DriveY: Removable DriveZ: Removable Drive
victor888 Posted June 8, 2009 Author Posted June 8, 2009 If the total drive letter doesn't exceed the R, S... that can be abtained.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now