如何使用批处理或 vbs 文件阻止 gpedit.msc、resmon.exe、msconfig.exe?

编程


我需要使用批处理或 vbs 文件阻止 gpedit.msc、resmon.exe、msconfig.exe 等应用程序,我在管理员模式下尝试了这些命令,但它不起作用

我尝试过的:

蝙蝠
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableResmon /t REG_DWORD /d 1 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableMSCONFIG /t REG_DWORD /d 1 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableGpedit /t REG_DWORD /d 1 /f​

解决方案1

您可以制作后台应用程序,并在后台应用程序上执行类似的操作

关闭另一个应用程序

using (Process process = Process.Start("resmon.exe")) {

       // Wait for 5 seconds and terminate the process.
       Console.WriteLine("Waiting 1 seconds before terminating" +
           " .exe.");
       Thread.Sleep(1000);

       // Terminate process.
       Console.WriteLine("Terminating with CloseMainWindow.");


  if(process != null)
       // Try to send a close message to the main window.
       if (!process.CloseMainWindow()) {

           // Close message did not get sent - Kill.
           Console.WriteLine("CloseMainWindow returned false - " +
               " terminating with Kill.");
           process.Kill();

       } else {

           // Close message sent successfully; wait for 2 seconds
           // for termination confirmation before resorting to Kill.
           if (!process.WaitForExit(2000)) {

               Console.WriteLine("CloseMainWindow failed to" +
                   " terminate - terminating with Kill.");
               process.Kill();
           }
       }
   }

コメント

タイトルとURLをコピーしました