• [原创] Win7全自动精简批处理_绝对原创,绝对给力_感谢无忧给了我一年的潜水


    2011htpcfans发表于 2012-5-5

    http://bbs.wuyou.net/forum.php?mod=viewthread&tid=210043

    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo 功能:本批处理(温柔处理版)作用仅仅是把Win7精简的手动部分自动化了,当然也是把最恶心的一部分自动化了,呵呵,后续部分还得用vLite或其他软件,网上列表多的是。本批处理首先提取5合1、4合1镜像中的指定镜像,然后挂载;温柔处理版精简绝大部分打印驱动,MDM驱动,FAX驱动,投影仪驱动(前4部分约占1个GB空间),精简部分ATI、NV驱动,并且在自备驱动时可安装打印机,或自动Update驱动;删除了winsxs中帮助文件,删除了recovery中winre.wim文件;暴力剩女版按照网上流行的洋鬼子的批处理删除了其他一些winsxs文件,有可能导致补丁不好打,建议只在极限暴力精简时使用。本处理全程约60-180分钟,你可以去运动一会了。本批处理绝对是做母盘或者适度精简版的的不二选择!说精简版不稳定的基本都是农民!本批处理精简的系统绝对稳定可靠,你还可以设置断点(pause),修改del_index.txt,log.txt删除时机(慎重),观察完整运行过程;本批处理可以二次开发,改变精简方案,改变功能调整方案,改变驱动(补丁)集成方案,适当编程,适用于win7,2008,X32,X64,8没试过,应该没问题,通用性极强;最后本批处理,每一步都是用微软的矛攻击微软的盾,绝无任何隐瞒,绝无任何病毒木马,与原版一样安全;建议大家先看下源文件,再随便试一下(可以出去放会风,或者利用垃圾时间让电脑自己做),绝对方便简单;还有它稍作改动,甚至不做改动,只需输入正确参数,可用作二次精简工具,你懂的,呵呵!当然本人从今年3月份买入联想K27才开始玩Win7,批处理也是最近现学现卖,iamgex,dism等操作都是刚入门,肯定有不少不足,欢迎大家斧正(QQ:396854818,htpcfans@yahoo.cn),准备玩转Win8!现在果断扔掉WinXP!当然,目前这个批处理已经是独步全球了。2012年5月,于浙江定海,四个工作日搞定,以副处级公务员党性保证,这绝对是利器一柄!
    @echo -----------------------------------------------------------------------
    @echo 请仔细阅读,谨慎选择目录,以免误操作删除重要资料。本程序先后顺序上实际上还可优化,请高手斧正。
    @echo 参数说明:%1,镜像索引号(1-5);%2,你的机器当前系统管理员名字,最好用是英文的,例如marc。
    @echo 辅助说明:所生成精简版wim文件在d:lite下,名字为win7_lite.wim,还有个未集成补丁的备份:win7_lite_Org.wim。
    @echo 辅助说明:所生成精简版wim文件文件体积较大,但实际上文件数肯定减少了,有兴趣的后续部分还得用vLite或其他软件处理。
    @echo 辅助说明:一次开机过程尽量只进行一组Dism操作,即只运行一次本批处理,不是我而是微软恶心。
    @echo 请先自行做好以下5项准备工作,其实也易如反掌,不超过5分钟了。
    @echo 注意:1、执行精简任务,请以管理员身份登录Win7 ,记住管理员名字,它可是参数2
    @echo 注意:2、本批处理默认Win7安装文件夹放在d:liteiso(sourcesinstall.wim),需先提取整个光盘文件,极力推荐微软原版。
    @echo 注意:3、本批处理默认mount操作文件夹在d:litemount,需先创建。
    @echo 注意:4、X32、X64位版本配套的imagex.exe(非gimagex)也放在d:lite文件夹下,需先行复制,同时只能有一个版本存在,因为名字固定。
    @echo 注意:5、请确保D盘有20GB以上空闲磁盘空间。
    @echo 注意:6、执行本批处理请不要用在vLite已精简过的安装文件夹(本批处理中所指iso)中,建议重新提取,防止各种无名意外。
    @echo 注意:7、X32、X64系统所用的imagex.exe有版本区别,其实更严重的是在X32系统中为X64位wim文件打补丁也可能遇到问题。
    @echo 注意:8、批处理使用方法例示:d:mydocwin7_lite 4 marc
    @echo 注意:9、封装驱动、补丁及语言包见第八阶段实例,也可以自己编程设计。
    @echo -----------------------------------------------------------------------
    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    (@echo 第一阶段,大约5-20分钟,准备工作。)>d:litelog.txt
    if  exist d:liteisosources goto okISO
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo 兄弟,你的Win7 DVD ISO文件提取路径不对,或者根本没提取,我等你看完说明,再解压好,按任意键继续。或按Ctrl+C 中止退出。
    pause
    :okISO

    if not "%1%"=="" goto okArguments
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo -----------------------------------------------------------------------
    @echo 兄弟,你没输入参数,我没法干活,我可是带详细指令的批处理,例如:d:mydocwin7_lite 4 marc。我自行退出,或你按Ctrl+C 中止。
    pause
    goto ESC
    :okArguments
    if not exist d:litedel_index.txt goto noDelLog
    del /f /s /q  d:litedel_index.txt  
    :noDelLog

    if not exist d:litemount goto mdMount 
    ::必须先清除子目录中权限较高的文件夹,才可以清除本级文件夹,Windows的恶心约定,并且微软还为我设了先有鸡还是先有蛋的问题,执行第一遍错误百出,我执行了两次,当然高手可能不怕。友情提示,第一遍时,错误百出,让它多飞一会,没什么大不了!

    dir d:litemount /ad /b /s >d:litedel_index.txt
    for /f %%i in (d:litedel_index.txt) do (@echo y|takeown /f %%i  /r >d:litelog.txt)
    for /f %%i in (d:litedel_index.txt) do (@echo y|cacls %%i /t /g %2:f >>d:litelog.txt)
    for /f %%i in (d:litedel_index.txt) do  rd %%i /s /q  
    @echo y|takeown /f d:litemount /r
    @echo y|cacls d:litemount /t /g %2:f
    rd d:litemount /s /q

    dir d:litemount /ad /b /s >d:litedel_index.txt
    for /f %%i in (d:litedel_index.txt) do (@echo y|takeown /f %%i  /r >d:litelog.txt)
    for /f %%i in (d:litedel_index.txt) do (@echo y|cacls %%i /t /g %2:f >>d:litelog.txt)
    for /f %%i in (d:litedel_index.txt) do  rd %%i /s /q  
    @echo y|takeown /f d:litemount /r
    @echo y|cacls d:litemount /t /g %2:f
    rd d:litemount /s /q

    :mdMount
    md d:litemount

    if exist d:liteimagex.exe goto existImagex
    @echo 兄弟,复制下imagex吧,要不我开不了工!我等着你,OK了,我继续。
    pause
    :existImagex
    ::我要删除同名文件,甚至是上一次已经做好的,呵呵!
    del /f /s /q  d:litewin7_lite.wim
    del /f /s /q  d:litedel_index.txt
    @echo 马上要开始正式工作了!


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    @echo 第二阶段,大约15分钟以内,从微软原始安装盘中应用需要的镜像(32位5取1或者64位4取1)。

    d:liteimagex /apply  d:liteisosourcesinstall.wim  %1  d:litemount


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    @echo 第三阶段,大约20分钟以内,取得以下文件夹所有权(Takeown),提升权限,完全控制(Cacls)。
    ::取得以下三个文件夹所有权,提升权限,完全控制。
    @echo y|takeown /f d:litemountwindowswinsxs /r
    @echo y|cacls d:litemountwindowswinsxs /t /g %2:f

    @echo y|takeown /f d:litemountwindowssystem32 ecovery /r
    @echo y|cacls d:litemountwindowssystem32 ecovery /t /g %2:f

    @echo y|takeown /f d:litemountwindowssystem32driverstorefilerepository /r
    @echo y|cacls d:litemountwindowssystem32driverstorefilerepository /t /g %2:f


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    @echo 第四阶段,大约5分钟以内,全自动/手动精简文件。
    del /f /s /q      d:litedel_index.txt
    del /f /s /q      d:litemountwindowssystem32 ecovery winre.wim

    del /f /s /q      d:litemountwindowswinsxsmanifests*ati*inf*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*ati*inf* >d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*chm*.* 
    del /f /s /q      d:litemountwindowswinsxs*chm*.*
    dir /ad /b /s     d:litemountwindowswinsxs*chm*  >>d:litedel_index.txt

    dir /ad /b /s     d:litemountwindowshelp*chm* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*fax*.* 
    del /f /s /q      d:litemountwindowswinsxs*fax*.*
    dir /ad /b /s     d:litemountwindowswinsxs*fax* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*flpy*.* 
    del /f /s /q      d:litemountwindowswinsxs*flpy*.*
    dir /ad /b /s     d:litemountwindowswinsxs*flpy* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*mdm*inf*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*mdm*inf* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*nv*inf*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*nv*inf*  >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnb*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnb* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnc*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnc* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnfx*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnfx* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prng*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prng* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnh*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnh* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prni*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prni* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnk*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnk* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnl*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnl* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnn*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnn* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prno*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prno* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnr*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnr* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prns*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prns* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnt*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnt* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*prnx*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*prnx* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowswinsxsmanifests*wia*inf*.* 
    dir /ad /b /s     d:litemountwindowswinsxs*wia*inf*  >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*ati*inf*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*ati*inf* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*nv*inf*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*nv*inf* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*fax*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*fax* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*mdm*inf*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*mdm*inf* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnb*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnb* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnc*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnc* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnfx*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnfx* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prng*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prng* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnh*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnh* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prni*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prni* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnk*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnk* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnl*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnl* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnn*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnn* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prno*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prno* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnr*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnr* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prns*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prns* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnt*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnt* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*prnx*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*prnx* >>d:litedel_index.txt

    del /f /s /q      d:litemountwindowssystem32driverstorefilerepository*wia*inf*.* 
    dir /ad /b /s     d:litemountwindowssystem32driverstorefilerepository*wia*inf*  >>d:litedel_index.txt

    for /f %%j in (d:litedel_index.txt) do (rd %%j /s /q)


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    @echo 第五阶段,大约15分钟以内,从刚才应用的在离线系统捕获镜像(肯定只有1个镜像),并复制一个备份,名字加Suffix:_Org。
    d:liteimagex /capture /compress maximum   d:litemount d:litewin7_lite.wim  "Win7_lite"
    copy d:litewin7_lite.wim d:litewin7_lite_Org.wim


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    @echo 第六阶段,大约30分钟以内,全自动清理三大文件夹;取得其他文件夹所有权(Takeown),提升权限,完全控制(Cacls),全部清理干净。
    rd d:litemountwindowssystem32 ecovery /s /q
    rd d:litemountwindowssystem32driverstorefilerepository /s /q
    rd d:litemountwindowswinsxs /s /q

    ::必须先清除子目录中权限较高的文件夹,才可以清除本级文件夹,Windows的恶心约定,并且微软还为我设了先有鸡还是先有蛋的问题,执行第一遍错误百出,我执行了两次,当然高手可能不怕。

    dir d:litemount /ad /b /s >d:litedel_index.txt
    for /f %%i in (d:litedel_index.txt) do (@echo y|takeown /f %%i  /r >d:litelog.txt)
    for /f %%i in (d:litedel_index.txt) do (@echo y|cacls %%i /t /g %2:f >>d:litelog.txt)
    for /f %%i in (d:litedel_index.txt) do  rd %%i /s /q  
    @echo y|takeown /f d:litemount /r
    @echo y|cacls d:litemount /t /g %2:f
    rd d:litemount /s /q

    dir d:litemount /ad /b /s >d:litedel_index.txt
    for /f %%i in (d:litedel_index.txt) do (@echo y|takeown /f %%i  /r >d:litelog.txt)
    for /f %%i in (d:litedel_index.txt) do (@echo y|cacls %%i /t /g %2:f >>d:litelog.txt)
    for /f %%i in (d:litedel_index.txt) do  rd %%i /s /q 
    @echo y|takeown /f d:litemount /r
    @echo y|cacls d:litemount /t /g %2:f
    rd d:litemount /s /q

    del /f /s /q  d:litedel_index.txt
    del /f /s /q  d:litelog.txt
    md d:litemount


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    @echo 第七阶段,大约15分钟以内,挂载目标镜像(肯定只有1个镜像)。
    dism /mount-wim /wimfile:d:litewin7_lite.wim /index:1 /mountdir:d:litemount


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    @echo 第八阶段,大约15-120分钟,为目标镜像封装补丁与驱动,禁用部分功能,请各位自行编程。
    ::Sample
    Dism /Image:d:litemount /Disable-Feature /FeatureName:MediaCenter
    ::Sample
    dism /image:d:litemount /add-package /packagepath:d:litelp.cab
    dism /image:d:litemount /set-uilang:zh-cn


    @echo 全自动/手动精简Win7 批处理,马宝银拙作,2012年5月。
    @echo -----------------------------------------------------------------------
    @echo 第九阶段,大约15分钟以内,保存卸载修改后的目标镜像(肯定只有1个镜像)。
    Dism /unmount-wim /mountdir:d:litemount /commit

    @echo Congratulations!   You Win!    Press Any Key,Exit.
    pause
    :ESC
    exit

    win7_lite_温柔处女版.rar

    @echo 注意:8、批处理使用方法例示:d:mydocwin7_lite 4 marc 这个什么意思?

    带参数批处理用法

    本批处理的用法,把它Copy到你随便哪个目录里,比如我的在d:mydoc,本来名字是win7_Lite_暴力剩女版.bat,把它改成方便的名字,比如我把它改成win7_Lite.bat,以管理员身份运行命令提示符,我的管理员名字marc,这是第二个参数,再说下镜像索引号,32位原版包括入门版、家庭初级版,家庭高级版,专业版,旗舰版,是1-5,64位版包括家庭初级版,家庭高级版,专业版,旗舰版,是1-4。想全自动精简64位专业版,方法就是先建好目录,提取好X64位ISO文件,在名令提示符中输入:"d:mydocwin7_lite  3 marc",不带引号,从前到后就是批处理目录、名字、索引号和管理员名字,以空格隔开,然后回车,好了,你可以休息2-3个小时了,让电脑去干吧。

  • 相关阅读:
    在Myeclipse中移除项目对Hibernate的支持
    使用MyEclipse可视化开发Hibernate实例
    利用MyEclipse自动创建PO类、hbm文件(映射文件)、DAO
    Mtk Camera
    Linux问题,磁盘分区打不开了
    Android SDK在线更新镜像服务器大全
    TeamTalk——ubuntu服务端部署
    Nginx
    VCC/AVCC/VDD/AVDD区别
    android studio and sdk mirror for China
  • 原文地址:https://www.cnblogs.com/liuzhaoyzz/p/6136187.html
Copyright © 2020-2023  润新知