未名Q

此生若能得幸福安稳,谁又愿颠沛流离。

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: :: 订阅 订阅 :: 管理 ::

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

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

xcopy E:\ "C:\Program Files\Windows AIK\Tools\PETools" /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 Files\WMQ";
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:\WINDOWS\SYSTEM32\CMD.EXE /E:ON
View Code

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

copy d:\winpe30\winpe.wim d:\winpe30\SOURCES\BOOT.WIM
copy "c:\program files\Windows AIK\Tools\x86\imagex.exe" c:\winpe30\iso\
oscdimg -n -bd:\winpe30\etfsboot.com d:\winpe30\ISO d:\winpe30\winpe_x86.iso

得到了PE启动的ISO文件 d:\winpe30\winpe_x86.iso

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

c:\windows\system32\sysprep\sysprep.exe /oobe /generalize /shutdown

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

imagex /capture c: \hnkrht\boot.wim "Boot" "Boot description" /compress maximum /verify
imagex /capture f: \hnkrht\windows.wim "Windows" "Windows from HNKRHT" /compress maximum /config \imagex\wimscript.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
\Windows\CSC
\Recycled
\Recycler
\$Recycle.Bin\*
\System Volume Information
\pagefile.sys
\hiberfil.sys
\Users\Administrator
\Users\Admin
\Windows\SoftwareDistribution\*
\Windows\Temp\*
\Windows\WindowsUpdate.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:\KRHTSOFT\PC.CMD
DEL /Q /F %0
:UCA
ECHO 请以管理员身份运行
PAUSE>NUL
:EXITBAT
View Code

Pc.cmd

@ECHO OFF
REM %SYSTEMDRIVE%\CLTOOLS\SHELLRUNAS.EXE /REG /QUIET | <PROGRAM>
FSUTIL>NUL
IF ERRORLEVEL 1 GOTO UAC
ECHO.
ECHO.
%SYSTEMROOT%\SYSTEM32\DEVMGMT.MSC
CHOICE /M "启动360驱动大师"
IF NOT ERRORLEVEL 2 "C:\PROGRAM FILES\360\360DRVMGR\360DRVMGR.EXE"
ECHO 迅雷:取消默认下载工具
"C:\PROGRAM FILES\THUNDER NETWORK\MINITHUNDER\BIN\THUNDERMINI.EXE"
ECHO 计算机名、系统保护
%SYSTEMROOT%\SYSTEM32\SYSDM.CPL
REM ECHO 日期格式 YYYY-MM-DD / 键盘和语言 中添加你所使用的输入法
REM %SYSTEMROOT%\SYSTEM32\INTL.CPL
ECHO 本地用户检查
%SYSTEMROOT%\SYSTEM32\LUSRMGR.MSC
D:\KRHTSOFT\Aida64\aida64.exe /r /database /hw /safe
CHOICE /M "安装360网管版"
IF NOT ERRORLEVEL 2 "D:\KRHTSOFT\360ENTINST(360.BAIFUTONG.NET_8080).EXE"
GOTO EXITBAT
:UAC
ECHO 请以管理员身份运行
PAUSE>NUL
:EXITBAT
View Code

User.cmd

@ECHO OFF
TITLE 请按提示操作...
ECHO.
ECHO 请点击 Agree 按钮
%SYSTEMDRIVE%\CLTOOLS\SHELLRUNAS.EXE /REG /QUIET
ECHO.
ECHO.
ECHO 1、设置“短日期格式”为:YYYY-MM-DD
ECHO 2、在“键盘和语言”中添加你所使用的输入法
ECHO.
ECHO.
ECHO 按任意键,开始设置。
PAUSE>NUL
%SYSTEMROOT%\SYSTEM32\INTL.CPL
REG IMPORT D:\KRHTSOFT\IMPORT.REG
START D:\KRHTSOFT\READER.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

 

posted on 2016-02-29 16:53  未名Q  阅读(769)  评论(0编辑  收藏  举报