2

I am trying to find a way to either disable or completely remove Chrome’s Task Manager.

My proposed solution involves using a batch-file running in the background to detect if the Chrome Task Manager is open, and shut down Chrome if it is. Unfortunately, I do not know batch programming and am low on time for this problem to be solved.

Here’s a couple of ideas I had for this:

  • This command detects how many instances of Chrome are running:

    tasklist /nh /fi "imagename eq chrome.exe" | find /i "chrome.exe" >nul && (wmic process where name="chrome.exe" | find "chrome.exe" /c

  • This command kills all Chrome processes:

    taskkill /im chrome.exe

This does not work because Chrome does not create a new process when the Task Manager is opened, though it does create a new window. (There is no change in the Processes tab of the Windows Task Manager, but there is one in the Tasks tab.)

I will settle for a program that shuts down Chrome if it detects two windows of it open, even partial solutions are welcome at this point.

6
  • let me guess you want to block users from closing tabs/visiting there own sites Nov 29, 2013 at 23:51
  • I bet it is some manager's new "wonderful" idea. Nov 29, 2013 at 23:55
  • 2
    this somehow screams XY problem Nov 30, 2013 at 0:03
  • 1
    Then don't regard it as such and solve the original problem. I inserted pieces of my proposed solution because it increased the chances of someone solving it.
    – user278048
    Nov 30, 2013 at 0:07
  • 3
    @user1472696 It's still somewhat XY, because we do not know why you want to disable the task manager. It sounds like disabling the task manager is an attempted solution to a different problem, rather than the actual end goal. If that is the case, then we may be able to help find an alternative method. (Also, I do not see how disabling the task manager would help in any way at all...)
    – Bob
    Nov 30, 2013 at 1:42

2 Answers 2

0

This should get you some of the way there.

For detecting if Task Manager is open - use something like this:

tasklist /fi "WINDOWTITLE eq Task Manager - Google Chrome" /v | find "chrome.exe"

In a batch file you will probably need to escape the pipe character:

tasklist /fi "WINDOWTITLE eq Task Manager - Google Chrome" /v ^| find "chrome.exe"

Then use an %ERRORLEVEL% check to see if you it found it and kill them all:

if "%ERRORLEVEL%" == "1" TASKKILL /IM chrome.exe /F

I'll leave you to loop in batch (consider adding a sleep too).

0

It would be better to merely close the Chrome Task Manager window rather than killing the whole browser, which seems to be your goal anyway.

If you’re not committed to a batch-file, then an easy way to accomplish this is to use an AutoHotkey script:

;Script paramters
#SingleInstance, force
#Persistent
SetBatchLines, -1
Process, Priority,, High

;Set up window hook
Gui +LastFound
hWnd:=WinExist()
DllCall("RegisterShellHookWindow", UInt,hWnd)
MsgNum:=DllCall("RegisterWindowMessage", Str,"SHELLHOOK")
OnMessage(MsgNum, "ShellMessage")
HSHELL_WINDOWCREATED:=1
Return

;Hook function
ShellMessage(wParam,lParam)
{
    if (wParam=HSHELL_WINDOWCREATED)               ;Window created
    {
        WinGetTitle, Title, ahk_id %lParam%        ;Get window title
        if  (Title="Task Manager - Google Chrome") ;Check if Chrome Task Manager
            WinClose, ahk_id %lParam%              ;Close it
    }
}

(Of course if you are looking for security and trying to lock the browser down, then this is not the right way to go. Unfortunately I’m not sure that Chrome natively supports a secure lock-down mode.)

9
  • Possibly some kiosk mode? Though that might be far more restrictive than simply the task manager.
    – Bob
    Nov 30, 2013 at 1:22
  • @Bob, one would think so, but the Task Manager still works even in kiosk mode, at least for the Chrome browser on a PC (I just tried it), I don’t know about on a Chromebook.
    – Synetech
    Nov 30, 2013 at 1:26
  • Synetech, I cannot express my gratitude great enough. It simply.. works.
    – user278048
    Nov 30, 2013 at 1:45
  • @Synetech Pity. Anyway, you might want to amend your script to use WinWait instead - I'm not sure if it would be more or less efficient than polling in a loop, but it will certainly feel cleaner.
    – Bob
    Nov 30, 2013 at 2:10
  • Actually, looks like ShellHook is even better for resource usage - no polling at all.
    – Bob
    Nov 30, 2013 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy