murphy78 DiskPart and Apply Image Script

Discussion in 'Scripting' started by murphy78, Apr 2, 2014.

  1. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    7,325
    11,489
    240
  2. Bira

    Bira MDL Member

    Oct 4, 2017
    122
    60
    10
    Hi Murphy78, how are you?
    doing here some identities in your script in my language I saw that, I do not know can be mistaken my, in these parts

    Code:
    :IMG64
    FOR %%i IN (Z Y X W V U T S R Q P O N M L K J I H G F E D C B A) DO (IF EXIST "%%i:\x64\Sources\install.wim" SET INSTALLIMAGE="%%i:\x64\Sources\install.wim"&GOTO :SETUPCHECK)
    FOR %%i IN (Z Y X W V U T S R Q P O N M L K J I H G F E D C B A) DO (IF EXIST "%%i:\x64\Sources\install.esd" SET INSTALLIMAGE="%%i:\x64\Sources\install.esd"&GOTO :SETUPCHECK)
    FOR %%i IN (Z Y X W V U T S R Q P O N M L K J I H G F E D C B A) DO (IF EXIST "%%i:\x64\Sources\install.swm" SET INSTALLIMAGE="%%i:\x64\Sources\install.swm"&SET SPLIT=1&SET SPLITPATTERN="%%i:\x86\Sources\install*.swm"&GOTO :SETUPCHECK)
    
    where I optimize in my
    
    :IMG64
    FOR %%i IN (Z Y X W V U T S R Q P O N M L K J I H G F E D C B A) DO (
        for %%j in (
            wim
            esd
            swm
        ) do (
            IF EXIST "%%i:\x64\Sources\install.%%j" (
                IF "%%j" equ "swm" (
                    SET INSTALLIMAGE="%%i:\x64\Sources\install.swm"
                    SET SPLIT=1
                    SPLITPATTERN="%%i:\x64\Sources\install*.swm"
                    GOTO :SETUPCHECK
                )
                SET INSTALLIMAGE="%%i:\x64\Sources\install.%%j"
                GOTO :SETUPCHECK
            )
        )
    )
    GOTO :SETUPCHECK
    
    and here another mistake
    
    :RUNDPEXISTING
    DISKPART /S X:\DISKPART.TXT
    SET ERRORTEMP=!ERRORLEVEL!
    IF !ERRORLEVEL! NEQ 0 (
    ECHO.
    ECHO THERE WERE ERRORS FORMATTING THE PARTITION
    ECHO.
    PAUSE
    GOTO :MAINMENU
    )
    GOTO :IMAGESELECTION
    )
    
    Where else do you get in mine, can you have one) more or not?
    
    :RUNDPEXISTING
    DISKPART /S X:\DISKPART.TXT
    SET ERRORTEMP=!ERRORLEVEL!
    
    IF !ERRORLEVEL! NEQ 0 (
        ECHO.
        ECHO THERE WERE ERRORS FORMATTING THE PARTITION
        ECHO.
        PAUSE
        GOTO :MAINMENU
    )
    GOTO :IMAGESELECTION