China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 05:12
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Lock your CMD, only can input password to use View 5,746 Replies 16
Original Poster Posted 2006-11-16 12:17 ·  中国 广东 广州 天河区 电信
初级用户
千浪小子
Credits 52
Posts 22
Joined 2006-10-19 01:02
19-year member
UID 66621
Status Offline
Lock your CMD, can only enter the password to use. The code is as follows

1: Save the following as lock.reg, note that there should be a blank line after Windows Registry Editor Version 5.00
Windows Registry Editor Version 5.00


"AutoRun"="lock.bat


2. Save the following as unlock.reg. This is for unlocking the CMD. Also, there should be a blank line after Windows Registry Editor Version 5.00
Windows Registry Editor Version 5.00


"AutoRun"=-


3. Save the following code as lock.bat
@echo off
title Password Verification
SETLOCAL
set pwd=0
set times=3

echo ________________________________________________________________________________
echo You are now using 's CMD. You cannot execute any commands without 's permission.
echo All your operations and messages used this time have been recorded in the log. If you don't have a password yet, please contact . If you already have a password, please enter it!
echo ________________________________________________________________________________
echo ####################################################################### >> e:\mylog.txt
echo Operation: Activate password verification Time: %time% Date: %date% >> e:\mylog.txt
echo Status: Waiting for verification... >> e:\mylog.txt
echo . >> e:\mylog.txt
echo

:password
set /p pwd= Please enter your password:
set /A times=%times%-1
if %pwd%==lgx goto pass
echo ***** Password verification error, please re-enter You have %times% more chances to enter the password *****
echo .
if %times%==0 goto close
echo Status: User entered password Verification failed Time: %time% >> e:\mylog.txt
goto password

:close
echo Status: User entered password incorrectly 3 times Program locked Time: %time% >> e:\mylog.txt
title Sorry, you cannot use 's CMD
echo --------------------------------------------------------------------------------
echo Since you failed the password verification 3 times, the program has been locked. You can no longer operate. You can choose to close this window or leave a message to contact . Please enter the message and press Enter to submit!
echo --------------------------------------------------------------------------------
echo

:message
echo ________________________________________________________________________________
set /p msg= Please enter your message:
echo . >> e:\mymsg.txt
echo ####################################################################### >> e:\mymsg.txt
echo Date: %date% Time: %time% >> e:\mymsg.txt
echo Message content: >> e:\mymsg.txt
echo %msg% >> e:\mymsg.txt
echo . >> c:\message.txt
echo …… OK ……
echo Your message has been recorded. You can choose to close the window or continue to leave a message
echo Operation: User left a message Time: %time% >> e:\mylog.txt
goto message

:pass
echo Status: Program is open, welcome to use Time: %time% >> e:\mylog.txt
title 's CMD
ENDLOCAL


4. Save the following code as setup.bat
@echo off
copy /y lock.bat %windir%\lock.bat
echo lock.bat installed successfully
regedit /s lock.reg
echo lock.reg registered successfully


5. Save the following code as uninstall.bat
@echo off
del /f lock.bat %windir%\lock.bat
echo lock.bat deleted successfully
regedit /s unlock.reg
echo lock.reg unregistered successfully



Instructions: This is adapted from the code written by an expert
uninstall.bat is for unlocking. The password here is lgx
If you want to define your own password, you can use the replacement method to replace all lgx in lock.bat with your password
There are a total of 5 files. Actually, it can all be done through one batch file.
setup.bat is used to install the CMD password lock. The principle should be understandable. It is to lock the CMD through the registry
Just run setup.bat to lock your CMD. Remember that the password is lgx and can be replaced freely.

Please pay attention to my QQ space
http://410454068.qzone.qq.com/

[ Last edited by lgx8280998 on 2006-11-16 at 12:23 PM ]
Floor 2 Posted 2006-11-16 12:45 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Regarding the issue of using batch processing to encrypt or set passwords, there have been many discussions in the forum. The current conclusion is generally: the scheme is not feasible because the code of batch processing is saved in plain text. Even if the so-called encryption processing is done on the code, it is very easy to be cracked (please click here to view the specific discussion) - maybe a bit discouraging for the original poster.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 3 Posted 2006-11-16 12:56 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
Hehe, it's something from a few years ago. There are too many cracking methods, but it's quite good for increasing the interest of newbies.
Floor 4 Posted 2006-11-16 17:25 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

I want to know what are the several cracking methods.
Floor 5 Posted 2006-11-17 01:42 ·  中国 甘肃 甘南藏族自治州 合作市 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
My way to deal with this is to download an xcmd.exe, which can do everything.

down: http://www.yx127.com/xcmd.exe
Floor 6 Posted 2006-11-17 02:41 ·  中国 江苏 南京 联通
高级用户
★★
Credits 525
Posts 222
Joined 2006-08-28 21:07
19-year member
UID 61476
Status Offline
This thing...
Can I directly run CMD.exe?
Floor 7 Posted 2006-11-17 05:22 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
19-year member
UID 58334
Gender Male
Status Offline
I tried but it didn't work. You can still open CMD.
Floor 8 Posted 2006-11-17 07:04 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Originally posted by eech at 2006-11-17 05:22:
It didn't work for me. You can still open CMD.


  Still can run it, which proves that the previous settings are not well done or there is an error. Or it's just that the system version is different. The above locking is for computers of the Windows NT series, right?
Floor 9 Posted 2006-11-17 08:25 ·  中国 上海 杨浦区 电信
新手上路
Credits 13
Posts 6
Joined 2006-11-16 19:09
19-year member
UID 70699
Gender Male
Status Offline
Great stuff, I've been looking for it for a long time, haha
Floor 10 Posted 2006-11-17 10:48 ·  中国 北京 联通
中级用户
★★
带走
Credits 435
Posts 88
Joined 2005-09-24 19:22
20-year member
UID 42793
Status Offline
Originally posted by lxmxn at 2006-11-16 17:25:

I want to know what are the several cracking methods.

The simplest one is CMD /D
Floor 11 Posted 2006-11-18 00:12 ·  中国 四川 成都 教育网
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
It's a pity that my cmd.exe is a cracked version, it won't read any registry, and it's only 98.5K in size, heh heh

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 12 Posted 2006-11-18 00:43 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
My cmd.exe is 95k in size
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 13 Posted 2006-11-23 03:54
中级用户
★★
DOS之日
Credits 337
Posts 161
Joined 2006-11-04 05:27
19-year member
UID 69523
Gender Male
Status Offline
This is good. I'm a newbie. Let's discuss again among newbies. Please give instructions from the veterans.
for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul
Floor 14 Posted 2007-12-29 16:45 ·  中国 广东 东莞 电信
新手上路
Credits 2
Posts 1
Joined 2007-12-29 15:37
18-year member
UID 107127
Gender Male
Status Offline
I think it's self-contradictory`````Is it really okay? Veteran, please teach me`````
Floor 15 Posted 2007-12-29 17:32 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
Direct cmd /d

/D Disable execution of AutoRun commands from the registry (see below)
Forum Jump: