Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use batch processing to prohibit the running of specified programs

Shulou Source: shulou.com Published: 2022-06-03 08:37:57 09月28日 Update

This article will explain in detail how to use batch processing to prohibit the running of specified programs. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Features:

1. Prohibit the running of specified programs

two。 Lift the prohibition of specified procedures

3. View all prohibited programs

The code is as follows:

@ echo off

MODE con COLS=40 LINES=18

Title prohibits and removes the operation of designated programs-- Chen Bing OO:286569692

: begin

Setlocal ENABLEDELAYEDEXPANSION

Cls

Echo.

Echo. ╭─╮

Echo. ╭───┤ chooses the following operation ├───╮

Echo. │ ╰─╯ │

Echo. │ │

Echo. │ A. Add the program │ to be banned

Echo. │ │

Echo. │ B. Delete the prohibited program │

Echo. │ │

Echo. │ C. View all prohibited programs │

Echo. │ │

Echo. │ Z. Exit the program │

Echo. │ │

Echo. ╰─╯

Echo.

Copy% systemdrive%\ WINDOWS\ jzcx% systemdrive%\ WINDOWS\ jzcx.txt > nul

Set / p enter= Please enter your choice:

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. Enter the program to be banned: press Y to return to the menu

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. Successfully added the program to be banned input%

Echo.

Echo. Any key, return to other actions

Copy% systemdrive%\ WINDOWS\ jzcx.txt% systemdrive%\ WINDOWS\ jzcx > nul

Pause > nul

Goto begin

: jinzhidel

Cls

Echo.

Echo.

Echo.

Echo.

Echo. The procedures for total prohibition are as follows:

Echo--

Echo.

Type% systemdrive%\ WINDOWS\ jzcx.txt

Echo.

Echo--

Echo.

Echo. Enter the prohibited program to delete: press Y to return to the menu

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 / CMV% 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. Operation completed

Echo.

Echo.

Echo. Any key, return to other actions

Copy% systemdrive%\ WINDOWS\ jzcx.txt% systemdrive%\ WINDOWS\ jzcx > nul

Pause > nul

Goto begin

: jinzhick

Cls

Echo.

Echo. The procedures for total prohibition are as follows:

Echo--

Echo.

Type% systemdrive%\ WINDOWS\ jzcx.txt

Echo.

Echo--

Echo.

Echo. Any key returns other actions

Pause > nul

Goto begin

This is the end of this article on "how to use batch processing to prohibit the running of specified programs". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, please share it for more people to see.

Tags: Program run article input more menu selection good practical successful code content function article knowledge Chen Bing A. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi Shulou Information Microsoft Linux