中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-09 20:35
47,811 topics / 349,897 posts / today 2 new / 48,255 members
DOS批处理 & 脚本技术(批处理室) » How to disable CMD
Printable Version  3,676 / 20
Floor1 mfdcxnf Posted 2008-09-11 18:13
初级用户 Posts 74 Credits 155
By modifying the registry, you can prohibit users from using the command interpreter (CMD.exe) and running batch files (BAT files).

Enter the registry key
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\,
create a double-byte value item DisableCMD, and modify its value to 2.
Then both the command interpreter and batch files cannot be run.
If you only want to prohibit the running of the command interpreter but allow the running of batch files, modify the value of DisableCMD to 1.

Both 1 and 2 are prohibitions, so what is 0? Of course, there are no restrictions.

I saw a method to disable the registry by modifying the registry, which works well, but I want to implement it with a batch file. I don't know how to modify it. Please help me, masters. I also want to learn how to modify the registry with a batch file. The more detailed the better. Thank you!
Floor2 huahua0919 Posted 2008-09-11 18:31
银牌会员 Posts 780 Credits 1,608
After modifying to 1, neither works. After modifying to 2, it has no effect winXP-SP2@cmd
Floor3 mfdcxnf Posted 2008-09-11 18:37
初级用户 Posts 74 Credits 155
Thanks to the correction from user 2, but how to implement it!
Floor4 tireless Posted 2008-09-11 18:44
银牌会员 Posts 1,122 Credits 2,025
The command-line tool reg.exe is used to operate the registry. Type reg /? to view the help.

=======================
Using "image hijacking" can disable the running of cmd.exe and batch processing simultaneously.
Disable

Restore


[ Last edited by tireless on 2008-9-10 at 10:47 PM ]
Floor5 huahua0919 Posted 2008-09-11 18:49
银牌会员 Posts 780 Credits 1,608
You wrote HKLM, so you can't find it
Floor6 mfdcxnf Posted 2008-09-11 18:52
初级用户 Posts 74 Credits 155
Thank you, friend on the 4th floor. You helped me solve the problem, but it's useless to post it back because you've prohibited running. Can your restored batch file still run? But I'm very grateful!
Floor7 HAT Posted 2008-09-11 20:42
版主 Posts 5,017 Credits 9,023
The recovery can use this method: generate a.reg file and then import it into the registry.
Floor8 tireless Posted 2008-09-11 22:56
银牌会员 Posts 1,122 Credits 2,025
Originally posted by mfdcxnf at 2008-9-10 10:52 PM:
Thanks to the friend on the 4th floor, you helped me solve the problem, but it's useless for you to post the recovery because you have prohibited running. Can your recovery batch processing still run? But thank you very much!

Run directly in the "Run" dialog box.
Floor9 qwertl Posted 2008-09-11 23:06
中级用户 Posts 243 Credits 461
How to set up disabling Windows scripts?
Floor10 mfdcxnf Posted 2008-09-12 20:16
初级用户 Posts 74 Credits 155
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v Hidden /t reg_dword /d 00000000 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t reg_dword /d 00000001 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v ShowSuperHidden /t reg_dword /d 00000000 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v Disableregistrytools /t REG_DWORD /d 1
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\cmd.EXE" /v debugger /t reg_sz /d debugfile.exe /f

In this way, it cannot be restored with REG. If anyone has a good move, please share it. Thank you! I want to be able to use it when I need it and prohibit it when I don't!
I don't know if the script can realize removing the prohibition. Batch processing and registry are definitely not okay.

[ Last edited by mfdcxnf on 2008-9-12 at 08:18 PM ]
Floor11 HAT Posted 2008-09-12 21:59
版主 Posts 5,017 Credits 9,023
Is xxx.inf okay?


What about xxx.vbs?


[ Last edited by HAT on 2008-9-15 at 04:37 PM ]
Floor12 mfdcxnf Posted 2008-09-13 07:19
初级用户 Posts 74 Credits 155
I have tested the code from the user above, but it still doesn't work
Floor13 HAT Posted 2008-09-13 09:49
版主 Posts 5,017 Credits 9,023
The code on floor 11 cannot unlock the registry? What is the error message?
Floor14 moniuming Posted 2008-09-13 11:00
银牌会员 Posts 574 Credits 1,335 From 广西
It can't run on my machine either, and the error message is shown in the following picture:

Floor15 qinbuer Posted 2008-09-13 13:04
高级用户 Posts 228 Credits 512
Could it be that your computer has deleted several host files that interpret VBS operations? I remember some internet cafes do this like that
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023