Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement bat File encryption and decryption script

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to implement bat file encryption and decryption scripts. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Bat encryption script (saved as a .bat file)

@ echo off

Cls

Color 2a

: start

Cls

Echo *

Echo * *

Echo * final version of BAT encryption *

Echo * *

Echo *

Echo.

Echo.

The final version of echo BAT encryption is an updated version of the BAT encryption tool, which has many advantages over the previous version of the encryption tool:

Echo.

Echo ★ can successfully encrypt any batch file at one time, making it easier.

Echo.

Echo ★ allows you to enter any batch that needs to be encrypted for greater encryption flexibility.

Echo.

Echo ★ can automatically judge the wrong input, making it more user-friendly.

Echo.

Echo description: enter the batch file that needs to be encrypted below, and directly enter the batch file name to encrypt the BAT under the current directory, or you can specify any BAT with a path. The encrypt.bat files generated under the current directory are encrypted batches.

Echo.

Echo author: Mulinson QQ:573381312 BYE

Echo.

Echo.

Echo.

Set / p file= Please enter the batch to be encrypted and press enter (Q = exit):

If "% file%" = = "Q" goto quit

Echo% file% | findstr / I "\ .bat $" > nul & & goto go

Echo% file% | findstr / I "\ .cmd $" > nul & & goto go

Cls

Echo =

Please enter echo correctly!

Echo =

Echo.

Echo.

Echo press any key to re-enter.

Pause > nul

Goto start

: go

If not exist "file%" goto newly

If exist encrypt.bat copy encrypt.bat encryptbak.bat

Echo%% a%% a% A%% a% a%% a% A%% a% a%% a% A%% a% a%% a% A%% a% a%% a% A% a%% a% a > "% tmp%\ encrypt.tmp"

Echo cls > > "% tmp%\ encrypt.tmp"

Type "% file%" > > "% tmp%\ encrypt.tmp"

Setlocal enabledelayedexpansion

For% I in ("% tmp%\ encrypt.tmp") do (

Echo% ~ zi > nul 2 > nul

Set size=%%~zi

Set numbness sizefreuffle 1!

Set / a modulated numb% 2

If! mod! Equ 0 (goto even) else (goto odd)

)

: even

Copy "% tmp%\ encrypt.tmp" encrypt.bat

Del "% tmp%\ encrypt.tmp"

Cls

Echo = =

Echo Congratulations, batch encryption succeeded ^!

Echo = =

Echo.

Echo.

Echo presses any key to exit.

Pause > nul

Goto quit

: odd

Echo. > > "% tmp%\ encrypt.tmp"

Copy "% tmp%\ encrypt.tmp" encrypt.bat

Del "% tmp%\ encrypt.tmp"

Cls

Echo = =

Echo Congratulations, batch encryption succeeded ^!

Echo = =

Echo.

Echo.

Echo presses any key to exit.

Pause > nul

Goto quit

: newly

Cls

Echo = =

Echo could not find the batch file, please re-enter it!

Echo = =

Echo.

Echo.

Echo press any key to start.

Pause > nul

Goto start

: quit

Exit

BAT decryption (saved as a .bat file)

@ echo off

Mode con: cols=80 lines=25

: index

Color 27

Cls

Echo ╭─ ──╮

Echo │ │

Echo ╭─┤ BAT decryption tool ├─╮

Echo │

Echo │ ╰─ ────╯ │

Echo │ │

Echo │ │

Echo │ this tool is used to decrypt encryption batches that confuse text encoding types! │

Echo │ │

Echo │ fill in the batch that needs to be decrypted below and press enter. │

Echo │ │

Echo │ recommends dragging batch files to be decrypted directly to this window for release. │

Echo │ │

After successful decryption, echo │ will generate "new_ file name to be decrypted. File suffix" │ in this program directory.

File in echo │ format. │

Echo │ │

Echo │ Note: if there is a file with "new_ file name to be decrypted. File suffix name" in this directory, │

Echo │ will be replaced. │

Echo │ │

Echo │ │

Echo ╰─── ──╯

Echo.

Set route=%cd%

Set ravel=

Set / p ravel= Please enter the batch to decrypt:

Set "ravel=%ravel:" =% "

If / I "% ravel:~-4%" = = ".bat" if exist "% ravel%" goto go

If / I "% ravel:~-4%" = = ".cmd" if exist "% ravel%" goto go

Cls

Echo ╭─╮

Echo ╭─┤ text error ├─╮

Echo │ ╰─╯ │

Echo │ │

Echo │ specifies that the file does not exist or is not a batch type! │

Echo │ │

Echo │ press any key to re-enter... │

Echo │ │

Echo ╰─ ─╯

Echo.

Echo.

Echo press any key to re-enter...

Pause > nul

Goto index

: go

For / f "tokens=*" c in ("% ravel%") do (

Cd / d "% ~ dpc"

If exist "% route%\ new_%%~nxc" attrib-s-h-r-a "% route%\ new_%%~nxc"

Echo author:pengfei@www.cn-dos.net > "% route%\ new_%%~nxc"

For / f "tokens=*"% I in (% ~ nxc) do (

Echo I > > "route%\ new_%%~nxc"

)

)

Cls

Echo ╭─╮

Echo ╭─┤ decryption into ├─╮

Echo │ ╰─╯ │

Echo │ │

Echo │ Congratulations, batch decryption succeeded! │

Echo │ │

Echo ╰─ ─╯

Echo.

Echo.

Echo press any key to exit.

Pause > nul

Exit

Thank you for reading! On "how to achieve bat file encryption and decryption script" this article is shared here, 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, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report