【问题标题】:how to make a vbscript do something when a program is open如何在程序打开时使 vbscript 执行某些操作
【发布时间】:2017-08-26 20:24:44
【问题描述】:

所以我需要的是当 cmd.exe 打开时运行 MsgBox 并关闭 cmd.exe
如:

' Code for when cmd.exe loads
MsgBox("Command Prompt Disabled")
' closes command prompt

谢谢!

我需要实际代码

【问题讨论】:

    标签: vbscript command-prompt msgbox


    【解决方案1】:

    不要使用 vbscript 来执行此操作.. 使用 GPO.. 因为如果有人禁用该脚本,您的安全控制就会被破坏。

    如果您正在为单个用户/单个机器进行编辑...

    使用您的控件编写注册表 vb 脚本或批处理文件可能会更快,而不是为您不想使用它的每个用户使用 GPO。如果 Windows 密钥中不存在系统,则创建系统密钥。需要注意的是,您是否有其他控件不会阻止通过大约 5 分钟的 Google 搜索禁用此功能。

    reg add "HKCU\Software\Policies\Microsoft\Windows\System"
    reg add "HKCU\Software\Policies\Microsoft\Windows\System" /t REG_DWORD /v DisableCmd /d 2
    

    为非管理员使用 Gpedit 或 OU 级别分配的策略

    User configuration\Administrative Templates\System\Prevent access to the command prompt
    

    考虑添加到非管理员用户组的其他政策。

    User configuration\Administrative Templates\System\Prevent access to registry editing tools
    User configuration\Administrative Templates\System\Don't run specified Windows Applications
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-11
      • 1970-01-01
      相关资源
      最近更新 更多