Jump to content

congnt92

Member
  • Posts

    128
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Vietnam

Posts posted by congnt92

  1. Maybe you should start with getting the notion that batch files on Windows NT systems are NOT "Dos" batches (and BTW it would be smart to use NOT the .bat extension but rather the .cmd one).

     

    The detection of CD-Rom drive letter is not a "new" problem, there are several examples on the board, a same CD-ROM drive may (obviously) get a different drive letter in different environments, the assigning of the Y: to the CD-ROM drive is most probably something "specific to your PE build.

    Something *like* this:

    SETLOCAL ENABLEDELAYED EXPANSIONSET /A Counter=1for %%b 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 (dir %%b:\ToolsforPE.ISO >nul 2>nul && (set isofile[!Counter!]=%%b:\ToolsforPE.ISO&&SET /A Counter+=1)IF NOT DEFINED isofile[1] echo ISO not foundbla ...

    Will put in isofile[1], isofile[2}, etc. all instances found.

     

    About the list, this works on XP (and may work on 7/8 as well :dubbio:):

    @ECHO OFFSETLOCAL ENABLEDELAYEDEXPANSIONSET list=FOR /F "tokens=*" %%A IN ('FSUTIL FSINFO DRIVES ^| FIND ":"') DO SET list=!list! %%AFOR /F "tokens=2,* delims= " %%A IN ('ECHO %list%') DO SET list=%%A %%BSET list

    jaclaz

     

    Tks for your help Jaclaz, I will try your code when I come back home.

     

    Just a quetion, Can you explain what diffrence between .bat and .cmd. You mean, if I want to create a "batch" file which run from within windows, then I should use .cmd extension, right?

     

    And I'm sorry for any inconvenience caused to you, But since you're master of .bat code, can you visit this topic and help me :thumbup

  2. Hi everyone,

    I'm sorry for my bad English and I'm sorry again if this box is not right place to create this topic.

     

    I'm creating .bat file will mount EFI partition by diskpart. But I'm not sure what partition order in Windows UEFI

     

    By default, this order is

     

    Par1: WinRE

    Par2: EFI

    Par3: Microsoft system reserved

    Par4: May recovery partition or C:

     

    If EFI is always par1 or par2, then I will create .bat like that

     

    echo select disk 0 > par.txt

    echo select partiton 2 >> par.txt

    echo assign letter = S: >> par.txt

    diskpart /s par.txt

    copy abc.efi  to S:\EFI\Boot

     

    But problem is, I'm not sure that EFI is always par1 or par2 or even par3.... par n.

    Can anyone have any idea ? How to detect EFI par if user do not use default partition order??

    Tks :)

  3. Perhaps a VBS script would be better suited to your needs, here is an example of looping threw all the non empty drives.

     

    '-> Object For RuntimeDim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> Varibles For Run TimeDim Drv, Dsk'-> Loop Threw All Drives   For Each Dsk In Fso.Drives      If Dsk.IsReady Then'-> Drive Type       Select Case Dsk.DriveType            Case 0: Drv = "Unknown"      Case 1: Drv = "Removable"      Case 2: Drv = "Fixed"      Case 3: Drv = "Network"      Case 4: Drv = "CD-ROM"      Case 5: Drv = "RAM Disk"          End select          WScript.Echo Dsk.DriveLetter & ":\ " & Drv      End If     Next 

    Tks for your help, gunsmokingman.

    I want to use .bat file because I just need a .bat to do all task.

    With this .bat, that say loadiso.bat, I can:

    - Find and detect path of ISO then set to var1

    - Allow user choose a drive letter then set to var2

    - Check if var2 is a free drive letter or already in use (by

    dir %var2%:

    command), then if user choose a "free" drive letter, run imdisk mount var1 to var2

    But I found that, if a drive letter is CDROM with not insert a CD, dir %var% will return that var2 is a free drive letter. So I must check drive letter of CDROM first, set it to var3, then if %var2%==%var3% >> echo can not use this drive letter, it is CDROM ....

     

    BUT now, I think that may using .bat to detect if there are more than 1 ISO file from root directory quite difficult, also using .bat to detect CDROM drive letter is quite difficult. So I will give up.

    I found that this command will show letters which alreary in use. Very simple, very quickly

     

    fsutil fsinfo drives

     

     

    Then if user choose a letter which exist from above list, .bat will echo %var2% is already use. And it always work because I found that any rebuild version of WinPE exist fsutil.exe.

     

    But I got another problems.

     

    On Mini Windows XP, fsutil fsinfo drives resturn result which C:\ D:\ E:\ F:\ with NUL between them.

    On Win7/8, it return C:\ D:\ E:\ F:\ with space betwwen them.

    How can I use for /f command ???

    for /f what token and what delims %%i in (A B C D E F G H ... Z) do set list=%%i

    to output:

    echo NOTE: ISO file can NOT be mounted to %list%:

    Tks

  4. Hi everyone!

    First I'm sorry for my bad English.

     

    I'm new with DOS also batch command so I create this topic to get some advices from you.

     

    I want to create a .bat file, which using imdisk to mount ISO file to virtual drive. (this .bat run on WinPE)

     

    It something like this

    set /p type=Type a letter:REM now run imdiskimdisk -a -f %isofile% %type%:

    with %isofile% is ToolsforPE.ISO (put on root of any partition)

     

    I got 2 problems

     

    1st:  detect if %type% is a CD/DVD drive, because imdisk cannot mount ISO to here.

    2nd:  detect where %isofile%

     

    I try this command to solved 1st problem

    for %%a 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 (fsutil.exe fsinfo drivetype %%a:|find "CD-ROM">nul&&set cdletter=%%a)echo CD-ROM drive letter is %cdrom%

    Real CD-ROM drive letter from my desktop is F:

    But if run it from WinPE with an ISO file already mounted to such as Y:, then above command will return cdrom is Y:

    What about my F: letter ?

     

    I try this command to solved 2nd problem

    for %%b 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 (dir %%b:\ToolsforPE.ISO >nul 2>nul && (set isofile=%%b:\ToolsforPE.ISOgoto :runimdisk)echo ISO not foundbla ...

    Still above problem, if we have 2 ISO with same name, put to root of 2 partition, then above command will set isofile to the first found. I want to improve .bat, it will print some text say that there are 2 ISO found, and ask user pick one to mount.

     

    Also I need another .bat to detect Microsoft EFI Partition, since EFI par does not have a letter, then I cannot use dir %%a:\efi or some thing like that.

     

    And I'm sorry, because I don't want to create another topic just ask for .bat file which can detect EFI par, I think my 3 problems are same and can put to one topic.

     

    Thanks.

     

    Edit:

    P/s: I found some hint from internet say using wmic to get CD drive, but I found that, some rebuild versions of WinPE, wmic does not exist, so I try fsutil instead.

  5.  

    What difference between OS in RAM vs PE in RAM.

    What part of the quote below did you fail to understand?   :dubbio:

    2 types of constructions are possible in Win8.1SE.

    - OS in RAM: to build a lightweight Win8.1 OS in RAM with the Administrator login and the full Windows 8.1 registry. This is the default option.

    Note that the startup and the administrator logon is faster on a real computer than on Virtual Machine, in any case for me, tested with an usb2 stick.

    - PE in RAM: to build a PE5 environment based on Windows 8.1 with the Sytem account.

    Some features may not work as desired in PE build type due to security restrictions in Windows 8.1.

     

     

    OK so, If we choose to build win 8.1 with OS in RAM option so it will be name as SE and build with PE in RAM it will be name as PE?

    I try to build 2 Win 8.1 with 2 options. But after load them, I cannot see what features we cannot use in PE but can be use on SE.

    Can you tell me them?

    And can you help me clearly understand what limited with System account vs Admin Login?

    Tks.

  6.  

    ust stupid question:

    Can anyone show me some differences between PE vs SE?

    PE is Preinstallation Environment

    So what is SE?

    Tks

    SE traditionally means "Second Edition", it became popular many years ago with the second release of Windows98, and in the case of Winbuilder it did exist a Win7PE which later was updated and modified becoming Win7PE_SE (project lately lead by ChrisR), when Windows 8 came out, the corresponding project to Win7PE_SE based on Windows 8 files became (still largely authored by ChrisR) Win8PE_SE.

    Little by little the "SE" lost its original meaning, basically becoming the "distinctive mark" of ChrisR's Winbuilder based projects, and when 8.1 came out, the PE part was simply dropped, leading to Win8.1 SE.

     

    Check the "history" parts on the project pages:

    http://w7pese.cwcodes.net/

    http://w8pese.cwcodes.net/

    http://win81se.cwcodes.net/

     

    jaclaz

     

    Tks for your info, Jaclaz.

    So SE just simply Second Edition? Just a name?

    We release a new version of product and then we change name for it ?

    I think from PE to SE, it must have some changes or differences, such as how it works or something like that.

     

    2 types of constructions are possible in Win8.1SE.
    - OS in RAM: to build a lightweight Win8.1 OS in RAM with the Administrator login and the full Windows 8.1 registry. This is the default option.
      Noted that the startup and the administrator logon is faster on a real computer that on Virtual Machine, in any case for me, tested with an usb2 stick.
    - PE in RAM: to build a PE5 environment based on Windows 8.1 with the Sytem account
      Some features may not work as desired in PE build type due to security restrictions in Windows 8.1.

     

     

     

    So with Win8PE means just PE. And with Win8.1SE, it like "real" OS?

    What difference between OS in RAM vs PE in RAM.

    Tks.

  7. Are you sure that delay comes from bootmgr?

    It boots instantly for me!

     

    I'm sure. Because if I use bootmgr original, no matter what happend. You can send me your bootmgr file after modified?

     

     

    I'm sorry. The reason why I get delay issue is resources folder was missing on my usb.

    I created a multi installing windows usb. So some unnecessary folder was removed: support, fonts, en-us, ... (include resourecs folder in boot folder). resources folder contain bootres.dll and because it was removed from my usb so i got delay issue.

     

    So now, if I can, I want to ask

    "How can I keep bootres.dll file same a USB which contain 2 sources of windows 7 and 8 ?". I guess that bootres.dll is load by boot.wim or BCD or something. Such as, if bootres.dll is loaded by Boot.wim, so I want to Boot.wim of windows 7 load bootre1.dll (to solve delay issue windows 7 installing), Boot.wim of windows 8 load bootre2.dll (to solve delay issue win 8 installing).

     

    Of coures, missing bootres.dll file will make delay issue, but this error is not affect to the installing windows. Just, It could be better if we can resolved.

    Thanks :)

  8.  

    Yeah, better let's wait for Win10 final  ;)

     

    Well, bmzip.exe does compress better, so the new bootmgr will be slighlty smaller.

    I use the same compression code MS uses, so the size will stay more or less equal.

     

    Maybe next year I'll add "ABC" feature.

     

    This should be the offsets for 6.3.9600.16415

    0000CF0E: 0F 900000CF0F: 88 900000CF10: AE 900000CF11: 02 900000CF12: 00 900000CF13: 00 90000194A9: 74 EB000194D3: 75 EB          At address D84 you have the \Boot\BCD string that you can change.

    Wow. Can you tell me how to calculate the offsets to change value?

  9. congnt92, please re-download and try again.

     

    http://1drv.ms/1plzVcu

     

    Thanks. I run it under windows 8.1 update 1 and windows 10 technical preview. It work fine on windows 8.1 update 1. It does not support for win 10.

    And I still have a question.

    - If we modify bootmgr manally (decompress, hex edit, checksum, recompress), the size of bootmgr (after modified) less original bootmgr about 3kb.

    - If using your tool, bootmgr after modified is same size with original bootmgr.

    Could you tell me why?

    And it would be greater if your tool allow user create modified bootmgr with "ABC" string instead "BC0, BC1, ..." :D

    And your tool work fine but I want to learn how to manually modified bootmgr as you guide me at #3 (decompress, hex edit, recompress ...). Can you guide me?

    And thanks again, JFX.

  10.  

    "Unsupported OS, newer ntdll.dll needed!"

     
    Means your running this tool not under Windows 8, and your ntdll.dll has not the functions to decompress and recompress bootmgr.
    You can put ntdll.dll from a win8 install next to the program an try again.

     

     

    I run this tool under windows 8.1 spring update. Version Bootmgr in windows 8.1 spring update is 6.3.9600.16415 not 6.3.9600.16384. May this is reason why i get that error.

     

     

    If the offset has changed, then please don't change these bytes.

     

    As you say, in ver 6.3.9600.16415, We only need to change \Boot\BCD to custom value. What about these

     

    0000065E: 0F 90

    0000065F: 88 90

    00000660: AE 90

    00000661: 02 90

    00000662: 00 90

    00000663: 00 90

    0002B1C1: 74 EB

    0002B1EB: 75 EB

     

     

    Thanks

  11. So for everyone how doesn't like command line or hex editing, I've updated my old zbootmgr tool.

     

    http://1drv.ms/1plzVcu

     

    Thanks for sharing :)

    But I don't know why running this tool for modity bootmgr windows 8.1, I get "Unsupported OS, newer ntdll.dll needed!" error

     

     

    Here you have the addresses for bootmgr.exe version 6.3.9600.16384 (RTM)

    0000065E: 0F 90

    0000065F: 88 90

    00000660: AE 90

    00000661: 02 90

    00000662: 00 90

    00000663: 00 90

    0002B1C1: 74 EB

    0002B1EB: 75 EB          At address 8AF90 you have the \Boot\BCD string that you can change.

     

    With bootmgr windows 8.1 update (6.3.9600.16415). At address 0000065E: is 01 not 0F. Can I change it to 90 ?

    And now, Windows 10 was came. I can't modify bootmgr windows 10 by this way.

    Can you update the method to modify bootmgr windows 8.1 update and bootmgr windows 10?

    Thanks

  12. Hi,

    In order to create USB multiboot that allow install multiple XP (or other OS) from an USB, I found some thread very helpful.

    http://www.msfn.org/board/topic/114543-solved-install-multiple-xpvistape2003-from-usb/

    www.msfn.org/board/topic/111406-how-to-install-xp-from-usb/

    Or some tools: USB_Multiboot_10, Easy2boot, ...

     

    But I still have a stupid question.

    Can I create USB to install multiple XP by this way??

     

    Root of USB

     

    grldr

    menu.lst

    XP64 folder (Extract XP 64bits ISO here)

    XP86 folder (Extract XP 32bits ISO here)

     

    menu.lst

    title  Windows XP x86 Setupfind --set-root /XP86/I386/SETUPLDR.BINchainloader /XP86/I386/SETUPLDR.BINtitle Windows XP x64 Setupfind --set-root /XP64/I386/SETUPLDR.BINchainloader /XP64/I386/SETUPLDR.BIN

    Thanks

     

  13. Hi to all.

    When I run this command

    bcdedit /enum all /v > C:\List.txt.

     

    List.txt

    ...Windows Memory Tester---------------------identifier              {b2721d73-1db4-4c62-bf78-c548a880142d}device                  partition=C:path                    \boot\memtest.exedescription             Windows Memory Diagnosticlocale                  en-USinherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}badmemoryaccess         YesReal-mode Boot Sector---------------------identifier              {57b67fd0-dbb6-11e3-9719-9cb70d9fba21}description             Grub4DOS...

    But there are so many information which I need. I just wan to get some lines below

    Real-mode Boot Sector---------------------identifier              {57b67fd0-dbb6-11e3-9719-9cb70d9fba21}description             Grub4DOS

    I want creat batch file to do this. Is it impossible?

    Can anybody help me? Thanks

     

  14. Hi!

    I use this command to create a new entry in the boot configuration data store and get ID value to delete entry later when needed by adding it to registry.

    @echo offfor /f "tokens=3" %%a in ('bcdedit /create /d "NTC Rescue HDD" /application BOOTSECTOR') do set guid=%%a reg add "HKLM\SOFTWARE\Grub4DOS\ID" /v ID /t REG_SZ /d %guid% /fpause

    Now I want to delete this entry, I use "bcdedit /delete" and it require ID value.

    And I use 

    reg query "HKLM\SOFTWARE\Grub4DOS\ID" /V ID

    to get ID for bcdedit delete command but the result is 

    id    REG_SZ    {f617cb88-d83a-11e3-9726-009c021e8215}

    So I just want to get {f617cb88-d83a-11e3-9726-009c021e8215} from the result, how can I get it? What command would be use? Such as Findstr or some thing ?? Please help me.

×
×
  • Create New...