Board logo

标题: 谁能为我代码简化一下 [打印本页]

作者: koala     时间: 2007-9-7 15:38    标题: 谁能为我代码简化一下

:loop
:: 此段是本人学习 c 语法中 if嵌套式复合语句后添加的,增强了脚本的智能性
cls
echo process正在关闭非系统必要进程,请稍候...

"%process%" > "%temp%\processlist.txt"

type "%temp%"\processlist.txt|"%find%" /i "explorer.exe" >NUl
if errorlevel==1 (

    type "%temp%"\processlist.txt|"%find%" /i "notepad.exe" >NUL
    if  errorlevel==1 (  
               
        type "%temp%"\processlist.txt|"%find%" /i "regedit.exe" >NUL
        if errorlevel==1 (

            type "%temp%"\processlist.txt|"%find%" /i "conime.exe" >NUL
            if errorlevel==1 (

                type "%temp%"\processlist.txt|"%find%" /i "internat.exe" >NUL
                if errorlevel==1 (

                    type "%temp%"\processlist.txt|"%find%" /i "ctfmon.exe" >NUL
                    if errorlevel==1 (

                        type "%temp%"\processlist.txt|"%find%" /i "mspaint.exe" >NUL
                        if errorlevel==1 (

                            type "%temp%"\processlist.txt|"%find%" /i "WinRAR.exe" >NUL
                            if errorlevel==1 (

                                type "%temp%"\processlist.txt|"%find%" /i "mstask.exe" >NUL
                                if errorlevel==1 (

                                    type "%temp%"\processlist.txt|"%find%" /i "mstask" >NUL
                                    if errorlevel==1 (

                                        type "%temp%"\processlist.txt|"%find%" /i "ddhelp.exe" >NUL
                                        if errorlevel==1 (

                                            type "%temp%"\processlist.txt|"%find%" /i "kernel32.dll" >NUL
                                            if errorlevel==1 (

                                                type "%temp%"\processlist.txt|"%find%" /i "kernel32" >NUL
                                                if errorlevel==1 (

                                                    type "%temp%"\processlist.txt|"%find%" /i "mmc" >NUL
                                                    if errorlevel==1 (

                                                        type "%temp%"\processlist.txt|"%find%" /i "alg.exe" >NUL
                                                        if errorlevel==1 (

                                                            type "%temp%"\processlist.txt|"%find%" /i "regsvc.exe" >NUL
                                                            if errorlevel==1 (

                                                                type "%temp%"\processlist.txt|"%find%" /i "inetinfo.exe" >NUL
                                                                if errorlevel==1 (

                                                                    type "%temp%"\processlist.txt|"%find%" /i "snmp.exe" >NUL
                                                                    if errorlevel==1 (

                                                                        type "%temp%"\processlist.txt|"%find%" /i "mdm.exe" >NUL
                                                                        if errorlevel==1 (

                                                                            type "%temp%"\processlist.txt|"%find%" /i "msgsrv.exe" >NUL
                                                                            if errorlevel==1 (

                                                                                type "%temp%"\processlist.txt|"%find%" /i "spool32.exe" >NUL
                                                                                if errorlevel==1 (

                                                                                    type "%temp%"\processlist.txt|"%find%" /i "spool32" >NUL
                                                                                    if errorlevel==1 (

                                                                                        type "%temp%"\processlist.txt|"%find%" /i "spoolsv.exe" >NUL
                                                                                        if errorlevel==1 (

                                                                                            type "%temp%"\processlist.txt|"%find%" /i "stisvc.exe" >NUL
                                                                                            if errorlevel==1 (

                                                                                                type "%temp%"\processlist.txt|"%find%" /i "taskmgr.exe" >NUL
                                                                                                if errorlevel==1 (

                                                                                                    type "%temp%"\processlist.txt|"%find%" /i "ttmplatform.exe" >NUL
                                                                                                    if errorlevel==1 (

                                                                                                        type "%temp%"\processlist.txt|"%find%" /i "myie.exe" >NUL
                                                                                                        if errorlevel==1 (

                                                                                                            type "%temp%"\processlist.txt|"%find%" /i "myie" >NUL
                                                                                                            if errorlevel==1 (

                                                                                                                type "%temp%"\processlist.txt|"%find%" /i "realsched.exe" >NUL
                                                                                                                if errorlevel==1 (

                                                                                                                    type "%temp%"\processlist.txt|"%find%" /i "wdfmgr.exe" >NUL
                                                                                                                    if errorlevel==1 (

                                                                                                                        type "%temp%"\processlist.txt|"%find%" /i "wuauserv.exe" >NUL
                                                                                                                        if errorlevel==1 (

                                                                                                                            type "%temp%"\processlist.txt|"%find%" /i "vb6.exe" >NUL
                                                                                                                            if errorlevel==1 (

                                                                                                                                type "%temp%"\processlist.txt|"%find%" /i "taskmon.exe" >NUL
                                                                                                                                if errorlevel==1 (

                                                                                                                                    type "%temp%"\processlist.txt|"%find%" /i "iexplore.exe" >NUL
                                                                                                                                    if errorlevel==1 (

                                                                                                                                        type "%temp%"\processlist.txt|"%find%" /i "editplus.exe" >NUL
                                                                                                                                        if errorlevel==1 (

                                                                                                                                            type "%temp%"\processlist.txt|"%find%" /i "emeditor.exe" >NUL
                                                                                                                                            if errorlevel==1 (
                                                                                                                                    
                                                                                                                                                echo.
                                                                                                                                                echo 进程终止完毕!
                                                                                                                                                goto :continue
                                                                                                                                                )
                                                                                                                                            "%process%" -k emeditor.exe
                                                                                                                                            goto :loop        
                                                                                                                                            )

                                                                                                                                        "%process%" -k editplus.exe
                                                                                                                                        goto :loop        
                                                                                                                                        )

                                                                                                                                    "%process%" -k iexplore.exe
                                                                                                                                    goto :loop        
                                                                                                                                    )

                                                                                                                                "%process%" -k taskmon.exe
                                                                                                                                goto :loop        
                                                                                                                                )

                                                                                                                            "%process%" -k vb6.exe
                                                                                                                            goto :loop        
                                                                                                                            )

                                                                                                                        "%process%" -k wuauserv.exe
                                                                                                                        goto :loop        
                                                                                                                        )

                                                                                                                    "%process%" -k wdfmgr.exe
                                                                                                                    goto :loop        
                                                                                                                    )

                                                                                                                "%process%" -k realsched.exe
                                                                                                                goto :loop        
                                                                                                                )

                                                                                                            "%process%" -k myie
                                                                                                            goto :loop        
                                                                                                            )

                                                                                                        "%process%" -k myie.exe
                                                                                                        goto :loop        
                                                                                                        )

                                                                                                    "%process%" -k ttmplatform.exe
                                                                                                    goto :loop        
                                                                                                    )


                                                                                                "%process%" -k taskmgr.exe
                                                                                                goto :loop        
                                                                                                )

                                                                                            "%process%" -k stisvc.exe
                                                                                            goto :loop        
                                                                                            )

                                                                                        "%process%" -k spoolsv.exe
                                                                                        goto :loop        
                                                                                        )

                                                                                    "%process%" -k spool32
                                                                                    goto :loop        
                                                                                    )


                                                                                "%process%" -k spool32.exe
                                                                                goto :loop        
                                                                                )

                                                                            "%process%" -k msgsrv.exe
                                                                            goto :loop        
                                                                            )

                                                                        "%process%" -k mdm.exe
                                                                        goto :loop        
                                                                        )

                                                                    "%process%" -k snmp.exe
                                                                    goto :loop        
                                                                    )

                                                                "%process%" -k inetinfo.exe
                                                                goto :loop        
                                                                )

                                                            "%process%" -k regsvc.exe
                                                            goto :loop        
                                                            )

                                                        "%process%" -k alg.exe
                                                        goto :loop        
                                                        )

                                                    "%process%" -k mmc
                                                    goto :loop        
                                                    )

                                                "%process%" -k kernel32
                                                goto :loop        
                                                )

                                            "%process%" -k kernel32.dll
                                            goto :loop        
                                            )

                                        "%process%" -k ddhelp.exe
                                        goto :loop        
                                        )

                                    "%process%" -k mstask
                                    goto :loop        
                                    )

                                "%process%" -k mstask.exe
                                goto :loop        
                                )

                            "%process%" -k WinRAR.exe
                            goto :loop        
                            )

                        "%process%" -k mspaint.exe
                        goto :loop        
                        )

                    "%process%" -k ctfmon.exe
                    goto :loop        
                    )
                    
                "%process%" -k internat.exe
                goto :loop        
                )

            "%process%" -k conime.exe
            goto :loop        
            )
                        
        "%process%" -k regedit.exe
        goto :loop  
        )

    "%process%" -k notepad.exe
    goto :loop
    )

"%process%" -k explorer.exe
goto :loop

:continue
if exist "%temp%\processlist.txt" del /q "%temp%\processlist.txt" >nul 2>nul
echo 下一步即将脚本控制中心 &pause:lol:

[ Last edited by koala on 2007-9-7 at 03:39 PM ]
作者: wudixin96     时间: 2007-9-7 16:16
妈呀,忒强了!!!!
作者: djmonkey1     时间: 2007-9-9 15:23
根本看不懂
作者: titiger     时间: 2007-9-15 19:48
用函数嵌套调用的方式来简化吧
作者: lp1129     时间: 2007-9-17 20:36
关闭非系统进程也用不着这么复杂啊
作者: lp1129     时间: 2007-9-18 10:51
信不信,用一句批处理就能结束不在文本中的进程名
作者: hxwxyz     时间: 2007-9-18 14:36
妈的  你也太强了吧  自卑中·····
作者: 6622186     时间: 2007-10-4 00:21
相信六楼, 不过楼主的精神可佳.
作者: koala     时间: 2008-9-24 20:33
现在明白了 可以用 佛如语句简化额




欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) Powered by Discuz! 2.5