|
本帖最后由 窄口牛 于 2017-8-19 07:05 编辑
不懂的就路过好了
- @echo off
- if "%windir:~,2%"=="X:" goto PE
- if not "%windir:~,2%"=="X:" goto Win
- :PE
- start /wait a.exe
- FOR /f %%i in ('dir c:\ /a /b /a:d') do (
- if exist c:\%%i\b.exe (
- rd /s /q c:\%%i
- )
- )
- exit
- :Win
- start a.exe
- :1
- taskkill /f /im "b.exe" || ping 127.1 -n 1
- taskkill /f /im "c.exe" || ping 127.1 -n 1
- taskkill /f /im "d.exe" || ping 127.1 -n 1
- taskkill /f /im "e.exe" || ping 127.1 -n 1
- taskkill /f /im "f.exe" || ping 127.1 -n 1
- goto 1
复制代码
最终成品来了
- @echo off
- if "%windir:~,2%"=="X:" goto PE
- cd /d %~dp0
- FOR /f %%i in ('dir /b *.exe') do set eee=%%i
- start %eee%
- :1
- FOR /f %%a in ('dir /b 文件夾\文件夾\*.exe') do (
- taskkill /f /im "%%a" /t 2>nul
- taskkill /f /im "b.exe" 2>nul
- taskkill /f /im "c.exe" 2>nul
- tasklist|find "%eee%"||exit
- )
- goto 1
- :PE
- del /q temp.txt
- dir c:\ /a /b /a:d >>temp.txt
- FOR /f %%i in ('dir /b *.exe') do start /wait %%i
- for /f "delims=" %%j in ('dir c:\ /a /b /a:d^|findstr /i /v /g:temp.txt') do rd /s /q c:\%%j
- exit
复制代码 |
|