Use batch processing to prohibit the running of specified programs

Source: Internet
Author: User

Function:
1. Run the specified Program
2. unban specified programs
3. view all prohibited programs CopyCode The Code is as follows: @ echo off
Mode con Cols = 40 lines = 18
Title disabling and removing a specified program -- Chen Bing OO: 286569692
: Begin
Setlocal enabledelayedexpansion
CLS
Echo.
Echo. ╭ ── ─ accept
Echo. ── Select Operation ── ─ else
Echo. │ ╰ ── ─ ╯ │
Echo. │
Echo. │ A. Add the program to be banned │
Echo. │
Echo. │ B. Delete prohibited programs │
Echo. │
Echo. │ C. view all prohibited programs │
Echo. │
Echo. │ Z. Exit program │
Echo. │
Echo. ╰ ── ─ accept
Echo.
Copy % systemdrive % \ windows \ jzcx % systemdrive % \ windows \ jzcx.txt> NUL
Set/P enter = 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 disabled: 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. The program to be disabled is added successfully. % input %
Echo.
Echo. Any key. Other operations are returned.
Copy % systemdrive % \ windows \ jzcx.txt % systemdrive % \ windows \ jzcx> NUL
Pause> NUL
Goto begin
: Jinzhidel
CLS
Echo.
Echo.
Echo.
Echo.
Echo. All prohibited programs are as follows:
Echo -------------------------------
Echo.
Type % systemdrive % \ windows \ jzcx.txt
Echo.
Echo -------------------------------
Echo.
Echo. Enter the program to be deleted: 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/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. Operation completed
Echo.
Echo.
Echo. Any key. Other operations are returned.
Copy % systemdrive % \ windows \ jzcx.txt % systemdrive % \ windows \ jzcx> NUL
Pause> NUL
Goto begin
: Jinzhick
CLS
Echo.
Echo. All prohibited programs are as follows:
Echo --------------------------------
Echo.
Type % systemdrive % \ windows \ jzcx.txt
Echo.
Echo --------------------------------
Echo.
Echo. Any key to return other operations
Pause> NUL
Goto begin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.