Jump to content

victor888

Member
  • Posts

    159
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    China

Everything posted by victor888

  1. Thank you very much, you poitns its bug, second hard disk wrong. I disklike break the rule too. I have to use dispart to replace mbrfix. a revised version will coming soon.
  2. Perhaps I am lost in registry searching. This CMD will take usb hard disk as internal hard disk if booted with pe on usb hard disk and drive letter c belongs to it. Sometimes when boot pe, no "diskperipheral " value found in registy which reselts to no internal hard disk found.
  3. OK, I will get mount point from registry, not from MOUNTVOL.EXE and make optimization.
  4. Ok, mounted drive letter "i" is incorrect. Please show me the result of MOUNTVOL.EXE. For drive letter R:, it must have has a volume id and been recognized as removable device.
  5. If you have any difficulties in understanding this batch, just let me know. I will give details.
  6. 1. Can fix flash disk driver letter: Seletion to fix flash disk driver letter: set USBDRV=U "U" is your flash drive letter to be fixed, you may change it as your need. For FIXED USB DISK (usb hard disk or fixed type usb disk) this selection nas no meaning. Also it is not fit to the condition that more than 1 flash disk exists. Do be sure that flash USB drive letter is not confilict with any other existing drive letter. 1. support WIN7 (WIN7 PE). 2. support VHD disk recognition. 3. code optimized. 4. add Automated run selection. selection for automated run  set AUTO=n (default is n, which means no intercourse needed. if AUTO was set to y, means automatic mode is opened.) === Special thanks to Jaclaz. === Function: order messed drive letters caused by, for example, installing xp from usb (removabe or hard disk), startting pe from usb etc. Win command used: reg (to query information from registry), find (combine with other command), wimc (to get all drive letters. For PE, all drive letters are find from registry ), mountvol (to change drive letters), diskpart.exe (to get disk drive letters, only for diskpart version) Workround: This batch work under winpe and winnt systems(XP,2k3,vista and WIN7). Note: 1. Don not run subst or net use prior to running it. mbrfix.rar
  7. Diskpart and fsutil are no longer needed. I found the secret in registry. I am compositing the batch now.
  8. In fact ervery thing about disk information is in the registry. I will try to get my answer there and not use others tool.
  9. I found one more powerfull disk tool here: http://technet.microsoft.com/zh-cn/sysinte...648(en-us).aspx DiskExt v1.1 which gives each disk it mount volume and drive letters.
  10. you make more progress in using wmic. I will try to continue.
  11. Jaclaz go! I am studying wmi/wmic these days too, hope an smart script come out ealier under your work and my support.
  12. WMI is too powerful, most valuable link: http://www.windows-management.com/scriptin...cal/#ADPPDD.htm FOR WIN2K3 AND VISTA diskpart, mountvol etc are of no use.
  13. I need your optimized version. I think of using wmic but do not study it. Your sample is really very good. WMIC command is too powerful.
  14. as long has the command fsutil, mountvol, diskpart and findstr exist, the batch does work.
  15. I think registry site mounteddevice is not reliable because when a removable device unpluged the drive letter and mount point still exist.
  16. Thanks to Jaclaz for his help. Temp files removed, running speed improved. The problem of when booting pe from usb hard disk sometimes usb hard disk get number DISK 0 and internal hd get disk 1 was solved. This batch file's former content view this: http://www.msfn.org/board/index.php?showtopic=123929 It is used under NT system such as win2k, PE, winxp and win2003. I haven't tested it under vista. Do run it on system drive of virtual drive. Do remember to close all programs and files/folders stored on non-system-drive because during the running period it will unmount drives except system drive and virtual drives. It is ideal to run it on newly installed system i.e. installing xp from pe, direct installing xp by using usb stick or usb hard disk. For using usb_multiboot_10.cmd I think there is no need to revise migrate.inf to fix usb stick drive letter. Just run this batch as your need. For non-Englisgh system, just change "removable" in this line: ::created by VICTOR888 ::ordering drive letters by drive type ::ordered drive letters are assigned to fixed disk, cdrom, usb hard disk and usb stick SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION ::get usbdisk amount set /a usbdiskam=0 for /f %%a in ('reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum /s ^| find "USBSTOR"') do ( set /a usbdiskam=!usbdiskam!+1 ) ::get removable usb disk amount and their drive letters set /a remusbam=0 if %usbdiskam% GTR 0 ( FOR /F "tokens=*" %%a in ('fsutil fsinfo drives ^| FIND /V ""') DO ( set dr=%%a SET dr=!dr:~-5,1! IF !dr! GTR B ( FOR /F "tokens=1 delims= " %%P IN ('fsutil fsinfo drivetype !dr!: ^| FIND "re"') DO ( set /a remusbam=!remusbam!+1 SET vname=%%P SET vname=!vname:~0,1! call set remusb=%%remusb%% %%vname%% ) ) ) ) ::get fixed usb disk amount if %usbdiskam% GTR 0 ( set /a fixedusbam=%usbdiskam%-%remusbam% ) else ( set /a fixedusbam=0 ) ::get total hard disks amount set /a totalhdam=0 for /f "skip=9 tokens=2" %%a in ('echo list disk ^| diskpart.exe') do ( set /a totalhdam=!totalhdam!+1 ) ::get innternal fixed hard disk amount set /a fixedhdam=%totalhdam%-%fixedusbam% ::get internal hard disk drive letters and fixed usb drive letters if %fixedusbam% equ 0 ( for /f "skip=9 tokens=2" %%a in ('echo list disk ^| diskpart.exe') do ( echo select disk %%a >selectdisk%%a.txt echo detail disk >>selectdisk%%a.txt for /f "tokens=3 skip=17" %%b in ('diskpart /s selectdisk%%a.txt') do ( set dr=%%b call set fixdrv=%%fixdrv%% %%dr%% ) del selectdisk%%a.txt ) ) else ( for /f "tokens=1 delims=\" %%a in ('reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum /v 0 ^| find "REG_SZ"') do set hd=%%a if "%hd:~-7%" neq "USBSTOR" ( for /f "skip=9 tokens=2" %%a in ('echo list disk ^| diskpart.exe') do ( set /a counter=!counter!+1 echo select disk %%a >selectdisk%%a.txt echo detail disk >>selectdisk%%a.txt if !counter! LEQ %fixedhdam% ( for /f "tokens=3 skip=17" %%b in ('diskpart /s selectdisk%%a.txt') do ( set dr=%%b call set fixdrv=%%fixdrv%% %%dr%% del selectdisk%%a.txt ) ) else ( for /f "tokens=3 skip=17" %%b in ('diskpart /s selectdisk%%a.txt') do ( set dr=%%b call set hdusb=%%hdusb%% %%dr%% del selectdisk%%a.txt ) ) ) ) else ( echo select disk 0 >selectdisk0.txt echo detail disk >>selectdisk0.txt for /f "tokens=3 skip=17" %%b in ('diskpart /s selectdisk0.txt') do ( set dr=%%b call set hdusb=%%hdusb%% %%dr%% del selectdisk0.txt ) for /f "skip=10 tokens=2" %%a in ('echo list disk ^| diskpart.exe') do ( set /a counter=!counter!+1 echo select disk %%a >selectdisk%%a.txt echo detail disk >>selectdisk%%a.txt if !counter! LEQ %fixedhdam% ( for /f "tokens=3 skip=17" %%b in ('diskpart /s selectdisk%%a.txt') do ( set dr=%%b call set fixdrv=%%fixdrv%% %%dr%% del selectdisk%%a.txt ) ) else ( for /f "tokens=3 skip=17" %%b in ('diskpart /s selectdisk%%a.txt') do ( set dr=%%b call set hdusb=%%hdusb%% %%dr%% del selectdisk%%a.txt ) ) ) ) ) ::get all drive letters except A FOR /F "tokens=*" %%b in ('fsutil fsinfo drives ^| FIND /V ""') DO ( set dr=%%b SET dr=!dr:~-5,1! IF !dr! GTR B call set alldrv=%%alldrv%% %%dr%% ) ::get drive letters with mount point FOR /F %%a in ('mountvol ^| findstr :\') do ( set dr=%%a set dr=!dr:~0,1! IF !dr! GTR A call set mountdrv=%%mountdrv%% %%dr:~0,1%% ) ) ::get virtual drives created by virtual CD soft, command subst, net use and ram disk etc. set virdrv=%alldrv% for %%a in (%mountdrv%) do call set virdrv=%%virdrv:%%a=%% set virdrv=%virdrv% %systemdrive:~0,1% ::get CDROM drive letters FOR /F "tokens=*" %%a in ('fsutil fsinfo drives ^| FIND /V ""') DO ( set dr=%%a SET dr=!dr:~-5,1! IF !dr! GTR A ( FOR /F "tokens=1 delims= " %%P IN ('fsutil fsinfo drivetype !dr!: ^| FIND "CD-ROM"') DO ( SET vname=%%P SET vname=!vname:~0,1! for /f %%b in ('mountvol !vname!: /l ^| find "\\"') do call set cdrom=%%cdrom%% %%vname%% ) ) ) ::ordering drive letters by internal fixed hard disk, cdrom, hard usb disk and removalbe usbdisk set neworder=%fixdrv% %cdrom% %hdusb% %remusb% set fulldrv=CDEFGHIJKLMNOPQRSTUVWXYZ for %%a in (%virdrv%) do call set fulldrv=%%fulldrv:%%a=%% :: get ordered vid set /a n=0 for %%a in (%neworder%) do ( if %%a neq %systemdrive:~0,1% ( for /f %%b in ('mountvol %%a: /l') do ( mountvol %%a: /d call echo %%b %%fulldrv:~!n!,1%%: >>c.txt set /a n+=1 ) ) ) for /f "tokens=1,2 delims= " %%a in (c.txt) do mountvol %%b %%a del c.txt orderdrv3.rar
  17. 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.
×
×
  • Create New...