当前位置: 移动技术网 > IT编程>网络>Dos/Bat > 用批处理实现禁止运行指定程序

用批处理实现禁止运行指定程序

2017年12月12日  | 移动技术网IT编程  | 我要评论
功能: 1.禁止运行指定程序 2.解除禁止指定程序 3.查看全部禁止程序复制代码 代码如下:@echo off mode con cols=40 lines=18 titl
功能:
1.禁止运行指定程序
2.解除禁止指定程序
3.查看全部禁止程序
复制代码 代码如下:

@echo off
mode con cols=40 lines=18
title 禁止和解除指定程序运行--陈兵 oo:286569692
:begin
setlocal enabledelayedexpansion
cls
echo.
echo. ╭─────────╮
echo. ╭───┤ 选择如下操作 ├───╮
echo. │ ╰─────────╯ │
echo. │ │
echo. │ a.添加要禁止的程序 │
echo. │ │
echo. │ b.删除已禁止的程序 │
echo. │ │
echo. │ c.查看全部禁止的程序 │
echo. │ │
echo. │ z.退出程序 │
echo. │ │
echo. ╰─────────────────╯
echo.
copy %systemdrive%\windows\jzcx %systemdrive%\windows\jzcx.txt>nul
set /p enter= 请你输入你的选择:
if not "%enter%"=="" set enter=%enter:~0,1%
if /i "%enter%"=="a" goto jinzhiadd
if /i "%enter%"=="b" goto jinzhidel
if /i "%enter%"=="c" goto jinzhick
if /i "%enter%"=="z" goto exit
goto begin
:jinzhiadd
cls
echo.
echo.
echo. 输入要禁止的程序:按 y 返回菜单
echo.
set /p input=
if /i "%input%"=="y" goto begin
echo %input%>>%systemdrive%\windows\jzcx.txt
reg add "hklm\software\microsoft\windows nt\currentversion\image file execution options\%input%" /v debugger /t reg_sz /d debugfile.exe /f
echo.
echo. 成功添加要禁止的程序 %input%
echo.
echo. 任意键,返回其他操作
copy %systemdrive%\windows\jzcx.txt %systemdrive%\windows\jzcx>nul
pause>nul
goto begin
:jinzhidel
cls
echo.
echo.
echo.
echo.
echo. 全部禁止的程序如下:
echo -------------------------------
echo.
type %systemdrive%\windows\jzcx.txt
echo.
echo -------------------------------
echo.
echo. 输入要删除的禁止程序: 按 y 返回菜单
echo.
set /p jinzhidel=
if /i "%jinzhidel%"=="y" goto begin
reg delete "hklm\software\microsoft\windows nt\currentversion\image file execution options\%jinzhidel%" /f
@for /f "tokens=* delims=" %%i in ('findstr /i /v /c:%jinzhidel% %systemdrive%\windows\jzcx.txt') do (
set var=%%i
echo !var!>>temp.txt
)
copy temp.txt %systemdrive%\windows\jzcx.txt>nul
del temp.txt
cls
echo.
echo.
echo.
echo.
echo. 操作完成
echo.
echo.
echo. 任意键,返回其他操作
copy %systemdrive%\windows\jzcx.txt %systemdrive%\windows\jzcx>nul
pause>nul
goto begin
:jinzhick
cls
echo.
echo. 全部禁止的程序如下:
echo --------------------------------
echo.
type %systemdrive%\windows\jzcx.txt
echo.
echo --------------------------------
echo.
echo. 任意键返回其他操作
pause>nul
goto begin

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网