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-07-15 01:14
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to prevent users from closing the running CMD window [Completed] View 6,396 Replies 27
Floor 16 Posted 2007-01-19 00:28 ·  中国 广东 肇庆 四会市 电信
中级用户
★★
Credits 384
Posts 189
Joined 2005-10-19 13:12
20-year member
UID 43709
Gender Male
Status Offline
又发现一个绝好的工具哈...
Found a really great tool, hey...
Floor 17 Posted 2007-01-19 00:54
中级用户
★★
DOS之日
Credits 337
Posts 161
Joined 2006-11-04 05:27
19-year member
UID 69523
Gender Male
Status Offline
for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul
Floor 18 Posted 2007-01-19 01:12 ·  中国 四川 成都 联通
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
The code of 14F is too messy.


The following is the lock.bat file


@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 in this use 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:\CMD\mylog.txt
echo Operation: Activate password verification Time: %time% Date: %date% >> e:\CMD\mylog.txt
echo Status: Waiting for verification... >> e:\CMD\mylog.txt
echo. >> e:\CMD\mylog.txt
echo

:password
set /p pwd=Please enter your password:
set /A times=%times%-1
if %pwd%==fangzi goto pass
echo ***** Password verification error. Please enter again. 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:\CMD\mylog.txt
goto password

:close
echo Status: User entered password incorrectly 3 times Program locked Time: %time% >> e:\CMD\mylog.txt
title Sorry, you cannot use 's CMD
echo --------------------------------------------------------------------------------
echo Because you failed the password verification 3 times, the program has been locked. You can no longer operate. You can choose to close
echo this window. You can also contact through messages. After entering the message, please press Enter to submit!
echo --------------------------------------------------------------------------------
echo

:message
echo ________________________________________________________________________________
set /p msg=Please enter your message:
echo. >> e:\CMD\mymsg.txt
echo ####################################################################### >> e:\CMD\mymsg.txt
echo Date: %date% Time: %time% >> e:\CMD\mymsg.txt
echo Message content: >> e:\CMD\mymsg.txt
echo %msg% >> e:\CMD\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 message Time: %time% >> e:\CMD\mylog.txt
goto message

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

-----------------------------------------------------------------

The following is 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
-----------------------------------------------------

The file used for uninstallation
The following is unlock.reg

@echo off
del /f lock.bat %windir%\lock.bat
echo lock.bat deleted successfully
regedit /s unlock.reg
echo lock.reg unregistered successfully



The solution of 15F is also good, heh heh. But personally, I don't like third-party tools
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
HUNRYBECKY +5 2007-03-10 08:40

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 19 Posted 2007-03-10 08:41 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Floor 20 Posted 2007-03-10 22:37 ·  中国 吉林 四平 联通
高级用户
★★★
Credits 859
Posts 413
Joined 2006-08-14 21:55
19-year member
UID 60532
Status Offline
Still want to find a piece of pure VBS code to lock the mouse?
Floor 21 Posted 2007-12-22 16:24 ·  中国 黑龙江 哈尔滨 联通
初级用户
Credits 109
Posts 40
Joined 2007-12-22 15:41
18-year member
UID 106471
Gender Male
Status Offline
Good
Floor 22 Posted 2007-12-22 19:19 ·  中国 湖南 株洲 荷塘区 电信
初级用户
Credits 71
Posts 34
Joined 2007-12-20 23:57
18-year member
UID 106311
Gender Male
Status Offline
Good stuff
Floor 23 Posted 2007-12-23 12:03 ·  中国 吉林 长春 联通
初级用户
Credits 21
Posts 11
Joined 2007-08-21 10:57
18-year member
UID 95486
Gender Male
Status Offline
Strongly support pure script works!!!
Floor 24 Posted 2007-12-23 13:30 ·  中国 广东 韶关 电信
初级用户
Credits 114
Posts 36
Joined 2007-12-22 17:42
18-year member
UID 106486
Gender Male
Status Offline
Write a VBS file

set ws=createobject("wscript.shell")
ws.run "your batch file name",vbhide

Just execute this VBS file to run your batch file in the background.
Floor 25 Posted 2007-12-29 23:17 ·  中国 广东 汕头 潮阳区 电信
高级用户
★★★
DOS时空
Credits 713
Posts 348
Joined 2007-02-10 13:59
19-year member
UID 79169
Gender Male
Status Offline
Floor 26 Posted 2008-01-01 23:49 ·  中国 福建 厦门 电信
新手上路
Credits 16
Posts 7
Joined 2007-12-26 19:27
18-year member
UID 106859
Gender Male
Status Offline
I also want to ask... There is no result so far.
Floor 27 Posted 2008-04-04 11:25 ·  中国 河南 郑州 联通
初级用户
Credits 35
Posts 17
Joined 2008-04-03 01:33
18-year member
UID 114814
Gender Male
Status Offline
Originally posted by HUNRYBECKY at 2007-1-18 08:48 AM:
Finally found the answer. My computer is a DEEPIN streamlined version. The other day when I was doing antivirus, I accidentally found a CMDOW.exe file, which was said to be a trojan. I checked online and found that many GHOST and streamlined systems have this file...


Finally found you, thanks a lot
Floor 28 Posted 2008-04-04 12:04 ·  中国 广东 珠海 电信
初级用户
★★
Credits 97
Posts 51
Joined 2008-03-19 15:26
18-year member
UID 113404
Gender Male
Status Offline
Forum Jump: