• 使用 Windows AIK 创建自定的客户端系统WIM文件


    Windows 7/2008 的AIK 3.0下载页面:地址链接 1.8G [3.1补充包为1.4G]

    安装3.0后,升级为3.1方法:

    xcopy E: "C:Program FilesWindows AIKToolsPETools" /ERDY

    安装AIK 3.0后,在开始菜单里 以管理员身份 运行 “部署工具命令提示符”。
    在命令提示符下,输入以下命令。

    rem 自动创建d:winpe30文件夹
    copype.cmd <x86|x64> d:winpe30
    

    自定义WINPE(startnet.cmd为自启动文件)

    查看文件夹和文件名
    imagex /dir image_file <image_number|image_name>
    查看 XML 描述
    imagex /info img_file [img_number | img_name] 
    
    解开并编辑
    imagex /mountrw image_file <image_number|image_name> image_path /check
    仅解开
    imagex /mount image_file image_number image_name image_path /check
    
    提交编辑但不卸载
    imagex /commit {/append image name} 
           /append 将装载的映像附加到现有 .wim 文件中。如果使用该选项,则必须为新映像指定一个名称。
    卸载或提交并卸载
    imagex /unmount image_path {/commit}

    startnet.cmd

    @ECHO OFF
    PATH %PATH%;"X:Program FilesWMQ";
    CHOICE /M "WPEINIT"
    IF NOT ERRORLEVEL 2 WPEINIT
    ECHO The GUI partitioning tool: DiskGens.bat
    SET STR=C D E F G H I J K L M N O P Q R S T U V W Y Z
    SET FILENAME=WINPE.CMD
    ECHO FILE %FILENAME% SEARCHING...
    FOR %%A IN (%STR%) DO IF EXIST %%A:\%FILENAME% ECHO INPUT %%A:\%FILENAME% TO RUN.
    ECHO Enable command expansion option.
    X:WINDOWSSYSTEM32CMD.EXE /E:ON
    View Code

    复制已经提交好的文件,并制作ISO文件。

    copy d:winpe30winpe.wim d:winpe30SOURCESBOOT.WIM
    copy "c:program filesWindows AIKToolsx86imagex.exe" c:winpe30iso
    oscdimg -n -bd:winpe30etfsboot.com d:winpe30ISO d:winpe30winpe_x86.iso

    得到了PE启动的ISO文件 d:winpe30winpe_x86.iso

    在已经安装、设置好的补丁与软件的Win7/2008系统中运行封装关机命令:

    c:windowssystem32sysprepsysprep.exe /oobe /generalize /shutdown

    使用d:winpe30winpe_x86.iso启动已经关机的电脑,进行捕作

    imagex /capture c: hnkrhtboot.wim "Boot" "Boot description" /compress maximum /verify
    imagex /capture f: hnkrhtwindows.wim "Windows" "Windows from HNKRHT" /compress maximum /config imagexwimscript.ini /verify
    rem WIM文件分割(不建议)
    imagex /split windows-full.wim windows.wim 3500 /check
    附加 imagex /append image_path image_file {"description"} {/check | /config configuration_file.ini | /verify}
    分卷 imagex /split image_file dest_file  size /check

    wimscript.ini (与imagex.exe同一目录为默认读取)

    [ExclusionList]
    $ntfs.log
    $windows.~bt
    $windows.~ls
    winpepge.sys
    WindowsCSC
    Recycled
    Recycler
    $Recycle.Bin*
    System Volume Information
    pagefile.sys
    hiberfil.sys
    UsersAdministrator
    UsersAdmin
    WindowsSoftwareDistribution*
    WindowsTemp*
    WindowsWindowsUpdate.log
    View Code

    在目标机器上恢复

    IMAGEX.exe /APPLY .BOOT.WIM 1 C: /VERIFY
    IMAGEX.exe /APPLY .WINDOWS.WIM 1 D: /VERIFY

    Installv3.bat

    @ECHO OFF
    REM CMD.EXE /E:ON
    REM CHOICE.EXE
    REM UPDATE 201609080920
    IF /I %1 EQU HELP (
        ECHO %0 ANY    :磁盘重新分区并安装ECHO %0 DISK   :仅磁盘重新分区ECHO %0 WIM    :仅安装ECHO %0 WIN    :格式化系统分区并安装ECHO %0 VIEW ? :查看磁盘?详细信息;
        ECHO %0 HELP   :显示本帮助信息GOTO EXITBAT
    )
    SET CURRENT=HNKRHTv3
    SET STR=A B C D E F G H I J K L M N O P Q R S T U V W Y Z
    SET BP=
    SET WP=
    SET CP=
    SET BWCP=
    REM SET EFILENAME=%CD%\%CURRENT%.7Z
    REM SET EPATH=%CD%\%CURRENT%-path.7Z
    IF /I %1 NEQ VIEW (
        DEL /Q /F %TEMP%DP_DIR.TXT
        FOR %%A IN (%STR%) DO (DIR %%A: /W >> %TEMP%DP_DIR.TXT)
    )
    IF /I %1 EQU WIM GOTO WIMBAT
    IF /I %1 EQU VIEW (
        ECHO SELECT DISK %2 > %TEMP%DP_XS.TXT
        ECHO DETAIL DISK >> %TEMP%DP_XS.TXT
    ) ELSE (
        ECHO LIST DISK > %TEMP%DP_XS.TXT
        ECHO SELECT DISK 0 >> %TEMP%DP_XS.TXT
        ECHO LIST PARTITION >> %TEMP%DP_XS.TXT
    )
    ECHO EXIT >> %TEMP%DP_XS.TXT
    DISKPART /S %TEMP%DP_XS.TXT
    IF /I %1 EQU VIEW GOTO EXITBAT
    SET DN=
    SET HG=250
    SET PP=80000
    SET LP=150000
    SET TXT1=
    SET TXT2=
    ECHO.
    IF /I %1 EQU WIN (
        SET TXT1=格式化BOOT与WINDOWS分区
        SET TXT2=WINDOWS分区的
    ) ELSE (
        SET TXT1=删除所有分区与文件
        SET TXT2=选择
    )
    ECHO 继续操作将%TXT1%,按 CTRL+C 中止。
    CHOICE /C 0123456789 /N /M "%TXT2%磁盘编号[0-9]:"
    SET /A DN=%ERRORLEVEL%-1
    SET BWCP=0
    GOTO BWCPIN
    :BWCPOK
    IF /I %BP% EQU %WP% GOTO BWCPIN
    REM IF /I %BP% EQU %CP% GOTO BWCPIN
    REM IF /I %CP% EQU %WP% GOTO BWCPIN
    SET BWCP=1
    ECHO SELECT DISK %DN% > %TEMP%DP_FQ.TXT
    IF /I %1 EQU WIN (
        ECHO SELECT PARTITION 1 >> %TEMP%DP_FQ.TXT
        ECHO FORMAT FS=NTFS QUICK LABEL="BOOT" NOERR >> %TEMP%DP_FQ.TXT
        ECHO ASSIGN LETTER=%BP% NOERR >> %TEMP%DP_FQ.TXT
        ECHO SELECT PARTITION 2 >> %TEMP%DP_FQ.TXT
        ECHO FORMAT FS=NTFS QUICK LABEL="WINDOWS" NOERR >> %TEMP%DP_FQ.TXT
        ECHO ASSIGN LETTER=%WP% NOERR >> %TEMP%DP_FQ.TXT
    ) ELSE (
        ECHO CLEAN >> %TEMP%DP_FQ.TXT
        ECHO CREATE PARTITION PRIMARY SIZE=500 >> %TEMP%DP_FQ.TXT
        ECHO FORMAT FS=NTFS QUICK LABEL="BOOT" NOERR >> %TEMP%DP_FQ.TXT
        ECHO ASSIGN LETTER=%BP% NOERR >> %TEMP%DP_FQ.TXT
        ECHO ACTIVE >> %TEMP%DP_FQ.TXT
        ECHO CREATE PARTITION PRIMARY SIZE=%PP% >> %TEMP%DP_FQ.TXT
        ECHO FORMAT FS=NTFS QUICK LABEL="WINDOWS" NOERR >> %TEMP%DP_FQ.TXT
        ECHO ASSIGN LETTER=%WP% NOERR >> %TEMP%DP_FQ.TXT
        ECHO CREATE PARTITION EXTENDED >> %TEMP%DP_FQ.TXT
        ECHO.
        CHOICE /C YN /N /M "磁盘%DN%是否大于%HG%G[Y/N]:"
        IF %ERRORLEVEL% EQU 2 (
            ECHO CREATE PARTITION LOGICAL >> %TEMP%DP_FQ.TXT
            ECHO FORMAT FS=NTFS QUICK LABEL="%CURRENT%" NOERR >> %TEMP%DP_FQ.TXT
            REM ECHO ASSIGN LETTER=%CP% NOERR >> %TEMP%DP_FQ.TXT
        ) ELSE (
            ECHO CREATE PARTITION LOGICAL SIZE=%LP% >> %TEMP%DP_FQ.TXT
            ECHO FORMAT FS=NTFS QUICK LABEL="%CURRENT%" NOERR >> %TEMP%DP_FQ.TXT
            REM ECHO ASSIGN LETTER=%CP% NOERR >> %TEMP%DP_FQ.TXT
            ECHO CREATE PARTITION LOGICAL >> %TEMP%DP_FQ.TXT
            ECHO FORMAT FS=NTFS QUICK LABEL="USERDATA" NOERR >> %TEMP%DP_FQ.TXT
        )
    )
    ECHO EXIT >> %TEMP%DP_FQ.TXT
    DISKPART /S %TEMP%DP_FQ.TXT
    IF /I %1 NEQ WIN BOOTSECT /NT60 %BP%: /MBR
    IF /I %1 EQU DISK GOTO EXITBAT
    :WIMBAT
    :BWCPIN
    IF /I "%BWCP%"=="1" GOTO APPLY
    FIND /I "卷" %TEMP%DP_DIR.TXT
    FIND /I "设备未就绪" %TEMP%DP_DIR.TXT
    ECHO.
    IF NOT DEFINED BWCP (
        REM %1=WIM NOT BWCP
        ECHO                       Y为不恢复,直接跳过。
    ) ELSE (
        ECHO                    未使用的盘符,切勿重复指定。
    )
    CHOICE /C ABCDEFGHIJKLMNOPQRSTUVWYZ /N /M "BOOT分区盘符[C~W/Y]:"
    FOR /F "TOKENS=%ERRORLEVEL%" %%I IN ("%STR%") DO SET BP=%%I
    CHOICE /C ABCDEFGHIJKLMNOPQRSTUVWYZ /N /M "WINDOWS分区盘符[C~W/Y]:"
    FOR /F "TOKENS=%ERRORLEVEL%" %%I IN ("%STR%") DO SET WP=%%I
    REM CHOICE /C ABCDEFGHIJKLMNOPQRSTUVWYZ /N /M "%CURRENT%分区盘符[C~W/Y]:"
    REM FOR /F "TOKENS=%ERRORLEVEL%" %%I IN ("%STR%") DO SET CP=%%I
    IF /I "%BWCP%"=="0" GOTO BWCPOK
    :APPLY
    IF /I %BP% NEQ Y IMAGEX.EXE /APPLY .BOOT.WIM 1 %BP%: /VERIFY
    IF /I %WP% NEQ Y IMAGEX.EXE /APPLY .WINDOWS.WIM 1 %WP%: /VERIFY
    REM IF /I %CP% NEQ Y 7ZA.EXE X %EFILENAME% -O%CP%: -Y
    REM IF /I %CP% NEQ Y 7ZA.EXE X %EPATH% -O%CP%: -Y
    :EXITBAT
    View Code

    FirstUse.cmd

    @echo off
    if EXIST D:KRHTSOFT%1.cmd (D:KRHTSOFT%1.cmd) else (echo %1 不存在.)
    rem CALL会返回,直接调用不会返回。
    exit
    View Code

    Inst_D.cmd

    @echo off
    fsutil>nul
    IF ERRORLEVEL 1 GOTO UCA
    SET FILENAME=HNKRHTv3
    SET STR=D E F G H I J K L M N O P Q R S T U V W
    ECHO 确认%FILENAME%分区盘符为D:
    FOR %%A IN (%STR%) DO (
        IF EXIST %%A:\%FILENAME%\%FILENAME%.EXE %%A:\%FILENAME%\%FILENAME%.EXE
        IF EXIST %%A:\%FILENAME%\%FILENAME%-patch.EXE %%A:\%FILENAME%\%FILENAME%-patch.EXE
    )
    ECHO 调整D:权限...
    PAUSE>NUL
    CACLS D:KRHTSOFT /T /E /C /G USERS:F
    CACLS "D:Program Files" /T /E /C /G USERS:F
    CACLS D:TDDownload /T /E /C /G USERS:F
    CACLS D:UsersDoc /T /E /C /G USERS:F
    CALL D:KRHTSOFTPC.CMD
    DEL /Q /F %0
    :UCA
    ECHO 请以管理员身份运行
    PAUSE>NUL
    :EXITBAT
    View Code

    Pc.cmd

    @ECHO OFF
    REM %SYSTEMDRIVE%CLTOOLSSHELLRUNAS.EXE /REG /QUIET | <PROGRAM>
    FSUTIL>NUL
    IF ERRORLEVEL 1 GOTO UAC
    ECHO.
    ECHO.
    %SYSTEMROOT%SYSTEM32DEVMGMT.MSC
    CHOICE /M "启动360驱动大师"
    IF NOT ERRORLEVEL 2 "C:PROGRAM FILES360360DRVMGR360DRVMGR.EXE"
    ECHO 迅雷:取消默认下载工具
    "C:PROGRAM FILESTHUNDER NETWORKMINITHUNDERBINTHUNDERMINI.EXE"
    ECHO 计算机名、系统保护
    %SYSTEMROOT%SYSTEM32SYSDM.CPL
    REM ECHO 日期格式 YYYY-MM-DD / 键盘和语言 中添加你所使用的输入法
    REM %SYSTEMROOT%SYSTEM32INTL.CPL
    ECHO 本地用户检查
    %SYSTEMROOT%SYSTEM32LUSRMGR.MSC
    D:KRHTSOFTAida64aida64.exe /r /database /hw /safe
    CHOICE /M "安装360网管版"
    IF NOT ERRORLEVEL 2 "D:KRHTSOFT360ENTINST(360.BAIFUTONG.NET_8080).EXE"
    GOTO EXITBAT
    :UAC
    ECHO 请以管理员身份运行
    PAUSE>NUL
    :EXITBAT
    View Code

    User.cmd

    @ECHO OFF
    TITLE 请按提示操作...
    ECHO.
    ECHO 请点击 Agree 按钮
    %SYSTEMDRIVE%CLTOOLSSHELLRUNAS.EXE /REG /QUIET
    ECHO.
    ECHO.
    ECHO 1、设置“短日期格式”为:YYYY-MM-DD
    ECHO 2、在“键盘和语言”中添加你所使用的输入法
    ECHO.
    ECHO.
    ECHO 按任意键,开始设置。
    PAUSE>NUL
    %SYSTEMROOT%SYSTEM32INTL.CPL
    REG IMPORT D:KRHTSOFTIMPORT.REG
    START D:KRHTSOFTREADER.DOCX
    View Code

     PEBootMake.bat

    @ECHO OFF
    REM UPDATE 2016-9-9 14:19
    FSUTIL>NUL
    IF ERRORLEVEL 1 GOTO UAC
    SET DN=
    SET DP=
    SET STR=D E F G H I J K L M N O P Q R S T U V W
    DEL /Q /F %TEMP%DP_*.TXT > NUL
    ECHO LIST DISK > %TEMP%DP_D.TXT
    ECHO SELECT DISK 1 >> %TEMP%DP_D.TXT
    ECHO LIST PARTITION >> %TEMP%DP_D.TXT
    ECHO EXIT >> %TEMP%DP_D.TXT
    DISKPART /S %TEMP%DP_D.TXT
    ECHO.
    CHOICE /C 0123456789 /N /M "%TXT2%磁盘编号[0-9]:"
    SET /A DN=%ERRORLEVEL%-1
    ECHO.
    FOR %%A IN (%STR%) DO (DIR %%A: /W >> %TEMP%DP_DIR.TXT)
    FIND /I "" %TEMP%DP_DIR.TXT
    FIND /I "设备未就绪" %TEMP%DP_DIR.TXT
    CHOICE /C DEFGHIJKLMNOPQRSTUVW /N /M "挂载盘符[D~W]:"
    FOR /F "TOKENS=%ERRORLEVEL%" %%I IN ("%STR%") DO SET DP=%%I
    ECHO SELECT DISK %DN% > %TEMP%DP_XY.TXT
    ECHO CLEAN >> %TEMP%DP_XY.TXT
    ECHO CREATE PARTITION PRIMARY >> %TEMP%DP_XY.TXT
    ECHO FORMAT FS=NTFS QUICK LABEL="HNKRHT_WIN7" >> %TEMP%DP_XY.TXT
    ECHO ASSIGN LETTER=%DP% NOERR >> %TEMP%DP_XY.TXT
    ECHO ACTIVE >> %TEMP%DP_XY.TXT
    ECHO LIST PARTITION >> %TEMP%DP_XY.TXT
    ECHO EXIT >> %TEMP%DP_XY.TXT
    DISKPART /S %TEMP%DP_XY.TXT
    BOOTSECT /NT60 %DP%: /MBR
    GOTO EXITBAT
    :UAC
    ECHO 请以管理员身份运行
    :EXITBAT
    PAUSE>NUL
    View Code

    WinPE.cmd

    @ECHO OFF
    ECHO SELECT DISK 0 > %TEMP%DP_D.TXT
    ECHO DETAIL DISK >> %TEMP%DP_D.TXT
    ECHO LIST DISK >> %TEMP%DP_D.TXT
    ECHO EXIT >> %TEMP%DP_D.TXT
    DISKPART /S %TEMP%DP_D.TXT
    View Code
    Tty725 说:
    欢迎转载,但请注明内容的来源或URL;
    [转]”篇章,必须保留原始来源且勿添加本blog指向。
  • 相关阅读:
    react之引用echarts
    vue之生命周期
    算法之冒泡排序
    算法之快速排序
    算法题之统计字符串中出现最多的字母
    使用http-proxy-middleware 代理跨域
    div产生的滚动条返回顶部
    Django实战(18):提交订单
    Django实战(17):ajax !
    Django实战(16):Django+jquery
  • 原文地址:https://www.cnblogs.com/Tty725/p/5228026.html
Copyright © 2020-2023  润新知