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 02:17
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to prevent users from closing the running CMD window [Completed] View 6,398 Replies 27
Original Poster Posted 2006-12-30 00:06 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Running a CMD batch program, to prevent users from accidentally or midway closing the CMD window, how to prohibit this behavior of users?

This problem has been perfectly solved, please refer to my answer on the 15th floor

[ Last edited by HUNRYBECKY on 2007-1-18 at 08:50 AM ]
Floor 2 Posted 2006-12-30 00:27 ·  中国 河南 许昌 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Variant ^_^:

If the mouse and keyboard are USB, it's easy. Uninstall the USB mouse and keyboard hardware (don't uninstall the keyboard if you need keyboard selection), scan them back after the operation is over

http://www.cn-dos.net/forum/viewthread.php?tid=25634
Floor 3 Posted 2006-12-30 01:06 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
It seems that there is a function to lock the mouse and keyboard in VBS.
Floor 4 Posted 2006-12-30 01:12 ·  中国 河南 许昌 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Originally posted by everest79 at 2006-12-29 12:06:
There seems to be a function to lock the mouse and keyboard in VBS.

Where is it? I also wanted to find it before but didn't find it.

There was a batch script before that could only lock the mouse by operating Notepad through VBS. Later, I found a way to modify it all in the batch script, so I didn't need to use VBS.
Floor 5 Posted 2006-12-30 01:17 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
Have you ever used a key macro tool made with VBS?
Floor 6 Posted 2006-12-30 01:44 ·  中国 河南 许昌 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Floor 7 Posted 2006-12-30 01:56 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
一叶枝头,万树皆春
Credits 2,564
Posts 1,127
Joined 2006-12-25 22:57
19-year member
UID 74552
Gender Male
Status Offline
Now I don't have it in hand either. The game I used to play for auto-fighting used it. It can limit the mouse within a certain area and can also intercept keyboard operations. It's just a VBA file.
Floor 8 Posted 2007-01-03 03:02 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
VBA files are secondary development files and must be started with relevant programs.
Floor 9 Posted 2007-01-03 03:06 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Originally posted by zh159 at 2006-12-30 00:27:
Indirectly^_^:

If the mouse and keyboard are USB, it's easy. Remove the USB mouse and keyboard hardware (don't remove the keyboard if the selection requires it), and scan it back after the operation ends

http://www.cn-dos.net/ ... This way can be achieved, but it's more troublesome. Is there a better way?
Floor 10 Posted 2007-01-08 04:43 ·  中国 广西 贵港 电信
新手上路
Credits 2
Posts 1
Joined 2007-01-08 04:08
19-year member
UID 75786
Gender Male
Status Offline
Originally posted by HUNRYBECKY at 2006-12-20 11:06 AM:
Running the CMD batch program, in order to prevent the user from accidentally or closing the CMD window halfway, how to prohibit the user's this behavior?


How to achieve it???
I also urgently want to know, please expert guide!!!
Floor 11 Posted 2007-01-08 04:53 ·  中国 广西 贵港 电信
高级用户
★★
学无尽止
Credits 635
Posts 244
Joined 2006-04-15 05:07
20-year member
UID 53857
Gender Male
From 广西贵港
Status Offline
Well, I also want to use this effect. I hope experts can answer. It would be easy if I can block that "Close" button.
学无尽止
Floor 12 Posted 2007-01-08 06:41 ·  中国 广东 湛江 遂溪县乌塘镇 电信
高级用户
★★★
Credits 959
Posts 311
Joined 2006-04-11 14:08
20-year member
UID 53665
Gender Male
From 广东-LianJiang
Status Offline
Originally posted by chainliq at 2007-1-8 04:53:
Well, I also want to use this effect. I hope experts can answer. It will be easy if we can block that "Close" button.

If that's the case, it can only be achieved by rewriting the system's DLL files.
Floor 13 Posted 2007-01-08 08:56 ·  中国 广西 北海 电信
初级用户
Credits 54
Posts 18
Joined 2005-11-05 01:38
20-year member
UID 44610
Status Offline
You can try autoit
Opt("WinTitleMatchMode", 4)
ShellExecute("ping.bat")
Sleep (1000)
WinSetState ( "classname=ConsoleWindowClass", "", @SW_DISABLE )

[ Last edited by zhoung0 on 2007-1-8 at 09:14 AM ]
Floor 14 Posted 2007-01-08 11:04 ·  中国 浙江 杭州 电信
中级用户
★★
Credits 305
Posts 85
Joined 2005-05-23 00:00
21-year member
UID 39004
Gender Male
Status Offline
Encrypt CMD so that even if the computer overflows, you can't get CMD permissions

Encrypt CMD so that even if the computer overflows, you can't get CMD permissions*Oz        k\WrGy  
Submitted by amxku on 2006, November 14, 7:59 PM. Technical notes Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat^jLTkA*V
The following is the lock.bat file
~7k(E'S*YOr Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat+d'@6Rn'VbA)M
1V`YO9B4} GC?$V
@echo offorum.315safe.comM+c7cKRHt$eb
title Password Verification 315safe.comc2d A8s_{U X
SETLOCAL
u \+U!F6q(b ec315 Security Network Technology Forum set pwd=0
j0]1d-]B315safe.com set times=3forum.315safe.come
p-Q?`9x

%z.{3Y T\-M#pxT4M315safe.com echo ________________________________________________________________________________315 Security Network Technology ForumK6H|Q:f(X7M5U
echo You are now using 's CMD. You cannot execute any commands without 's permission.
8F8KQ$d*U9if315safe.com echo Your all operations and messages in this use have been recorded in the log. If you don't have a password yet, please contact 315safe.comBj{9DZ^ E+d
echo for contact. If you already have a password, please enter your password! Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat0|zl {z F bU(e
echo ________________________________________________________________________________forum.315safe.comc-L$lFA.L
]O
echo ####################################################################### >> e:\CMD\mylog.txt
7y-L"l9N%@A{Uforum.315safe.com echo Operation: Activate password verification Time: %time% Date: %date% >> e:\CMD\mylog.txt



-}dne8m,e(H0O#p Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat8S+K7pt,Y
qq-a
:passwordu:HzbcGFJ:s
set /p pwd= Please enter your password:
.m)rW'`3A315safe.com set /A times=%times%-1
T/sW+Jv4T315safe.com if %pwd%==fangzi goto passforum.315safe.comf-G,u3og9vw?
echo ***** Password verification error. Please enter again. You have %times% more chances to enter the password *****
5VZ:|N/gmo Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat echo .
_\KOH{Ax;m315 Security Network Technology Forum if %times%==0 goto close315safe.com{:s:D"LB!_k
echo Status: User entered password Verification failed Time: %time% >> e:\CMD\mylog.txt Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chatS%hN8^?&BLq-G$o
goto password
-Lw:fFx"VA"u
i-JRu
P4D4qforum.315safe.com:close315safe.comr%DnGGc
echo Status: User entered password incorrectly 3 times Program locked Time: %time% >> e:\CMD\mylog.txtX y3K"|n1F4Sz
title Sorry, you cannot use 's CMD
uUK"\@n!j5u} Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat echo --------------------------------------------------------------------------------/? Xx;Z
J0tY!MkuK
echo Because you failed the password verification 3 times, the program has been locked. You can no longer continue to operate. You can choose to close

a:\`+@,DO&@ _ Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat echo This window. You can also contact through messages. Please enter the message and press Enter to submit!
qF5~rguC4xforum.315safe.comecho --------------------------------------------------------------------------------315safe.comHh/j,H2a(iK@4s%g
echo Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chatKf q {p'Z*Q

-]1ai/Ae(Eyforum.315safe.com:message
^$PeE\M5IC315 Security Network Technology Forum echo ________________________________________________________________________________ Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat4XWG'f:j
zPKS
set /p msg= Please enter your message:
/g+@{X3~])H315safe.comecho . >> e:\CMD\mymsg.txtP;l;@at*n%S lgf q
echo ####################################################################### >> e:\CMD\mymsg.txtforum.315safe.com o"c'H4q&Q]y
echo Date: %date% Time: %time% >> e:\CMD\mymsg.txt315 Security Network Technology ForumI-K/H7pB0Zo
echo Message content: >> e:\CMD\mymsg.txt315safe.comKg$rY:GI
echo %msg% >> e:\CMD\mymsg.txt
@X(IdM,K/?vEecho. >> c:\message.txt315safe.coma$qki9Hk
echo …… OK …… Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat `ek/YC







's CMD
v:C_-O+x5s-I$}315 Security Network Technology Forum ENDLOCAL
#_d }6DY*G
a#d9{ Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat6y$^.y#i5e:dU2v
-----------------------------------------------------------------forum.315safe.com,P
^3~8w Y`"Oq0k


_l6z#Uq
s+T.b Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat315safe.com2F.Hc|*\A
FD`5B
@echo off
C)e \Z0lnE s315 Security Network Technology Forum copy /y lock.bat %windir%\lock.bat315 Security Network Technology Forum!p9i#Ab3RL3`
echo lock.bat installed successfully
O:j

Z\Tn"q315safe.comecho lock.reg registered successfully
1\8qx_2|$\e
s315 Security Network Technology Forum-----------------------------------------------------
-K9y$





]
Xe:R315safe.com del /f lock.bat %windir%\lock.bat
A:k8T4o$VKm
u%c315 Security Network Technology Forum echo lock.bat deleted successfully
8c$z'w;y;cfT.lLn0} Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat regedit /s unlock.reg_2Z7N w,T$]b
echo lock.reg unregistered successfully
'k#h@ `.U*ckIO Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat
'z4i+Ksv5Fh------------------------------------------------------

w!lZV3F3\
B Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat315safe.com7HR3Iam]L"V
Double-click setup.bat to install!
]&y,z] ^zPvM!~9i315safe.com
%pGR/PVirn7SX When using CMD, the password is fangzi (all in lowercase, the password here is case-sensitive) Computers, networks, information, technology, security, routers, network administrators, Windows, Vista, databases, websites, development, downloads, chit-chat N7ms5LT}(w
All logs are stored in E:\CMD\mylog.txt315 Security Network Technology Forumq~ o6vb8H(z&U3a
All messages are stored in E:\CMD\mymsg.txt
Floor 15 Posted 2007-01-18 08:48 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Finally found the answer. My computer is a DEEPIN slim version. A few days ago, I accidentally found a CMDOW.exe file during antivirus scanning, which was said to be a trojan. I checked online and found that many GHOST and slim systems have this file, and many people also found it to be a trojan or virus when checked, but it was finally determined that this tool is not a virus or trojan and can be used with confidence.

The CMDNOW tool is very powerful, specially used to handle DOS or non-DOW windows. You can add CMDOW.EXE @ /DIS at the beginning of the batch processing to prohibit changing the window. To hide the window, use CMDOW.EXE @ /HID. This command can be downloaded from http://commandline.co.uk.

The English help of this tool is as follows:

CMDOW Win32 Commandline Window Utility for NT4/2000/XP.
(C) Copyright 2001-2004 Ritchie Lawrence, http://www.commandline.co.uk.

CMDOW
CMDOW /TH | /TV | /MA | /CW | /UW | /AT | /FS | /WM
CMDOW window {

}
CMDOW /RUN file

window List specified window (if omitted, all windows are listed).
/T List windows only shown on the taskbar.
/B List windows using bare format (no heading information).
/F List windows showing full information (don't truncate any fields).
/P List windows showing position and size (left, top, width and height).

/TH Tile windows horizontally. /TV Tile windows vertically.
/MA Minimize all windows. /CW Cascade windows.
/UW Undo tile/minimize/cascade. /AT Intelligent -
/FS Switch to full screen mode. /WM Switch to window mode.

/ACT Activate specified window. /INA Inactivate specified window.
/ENA Enable specified window. /DIS Disable specified window.
/VIS Unhide specified window. /HID Hide specified window.
/MIN Minimize specified window. /MAX Maximize specified window.
/RES Restore specified window. /REN Rename specified window.
/TOP Make window always on top. /NOT Make window not always on top.
/MOV Move specified window. /SIZ Resize specified window.
/CLS Close specified window. /END Kill process linked to window.

/RUN Executes or opens specified file using associated application.
state Initial show state of window (/MIN, /MAX or /HID). Default is normal.
args Optional commandline arguments passed to launched application.

Specify a window by its caption (case insensitive) or handle in hex format.
The At symbol '@' may be used to refer to this window. For more help on any
parameter use CMDOW /? <parameter>. Eg CMDOW /? /RUN or CMDOW /? window.
Forum Jump: