How to create a desktop shortcut to shutdown taskbar overflow apps

Page 2 of 2 FirstFirst 12

  1. Posts : 1,191
    Windows 10
       #11

    taskkill /f /IM steam.exe /f being forced termination

    /t is also good because it kills any child process which will just die anyway but this is good to add.

    - - - Updated - - -

    taskkill /t /f /IM steam.exe

    - - - Updated - - -

    the output you posted is also telling you to use /f
    Reason: This process can only be terminated forcefully (with /F option)

    - - - Updated - - -

    Also note that there can be data loss that occurs from doing this but because you are doing it at shutdown it should not really be to much concern because you are not using the applications really at that time.

    You can potentially see state changes not applying or reverting to previous states like this and maybe some small data inconstancy depending on how any of the apps save stuff. Overall though it should not matter.
      My Computer


  2. Posts : 114
    Windows 10 Pro
    Thread Starter
       #12

    @Malneb Thanks . Since it said "This process can only be terminated forcefully (with /F option)" I was ready to add the F/. Thanks for adding the 't/'. Good idea.
    But what of the ones that say "success" meanwhile it was not at all. Perhaps I should add the 'T' there too, of F and T.
    and then of course there are the ones that say, "process "name" not found."? Certainly they are there. I looked them up. So how could they not be found? Or how can it find it?
    Thanks again
      My Computer


  3. Posts : 1,191
    Windows 10
       #13

    Code:
    @echo off
    set program=notepad.exe steam.exe notepad++.exe paintdotnet.exe example1.exe example2.exe
    (for %%t in (%program%) do ( 
    	taskkill /t /f /IM %%t
    ))
    shutdown /s /t 10
    pause
    I nicer way to do it is this just change the programs in the variable to the ones you use and you can remove or alter the shutdown time too.

    - - - Updated - - -

    yes just add the /t and /f commands. If it is saying not found then you will have the name wrong for the .exe name or the program is no longer open. If it says success but the app is still open then it must have process still open but the /t command should help with that.
    Last edited by Malneb; 17 May 2023 at 01:38.
      My Computer


  4. Posts : 114
    Windows 10 Pro
    Thread Starter
       #14

    I'll study your proposal. Gotta go to work now, Hopefully I will not have problems getting back here at 'tenforums' (Here in China I often need VPN to do so). thnx
      My Computer


  5. Posts : 1,191
    Windows 10
       #15

    pintree3 said:
    But what of the ones that say "success" meanwhile it was not at all. Perhaps I should add the 'T' there too, of F and T.
    and then of course there are the ones that say, "process "name" not found."? Certainly they are there. I looked them up. So how could they not be found? Or how can it find it?
    Thanks again
    You would have to return the PID names using something like tasklist.exe but that becomes more involved. I think you should be able to just use taskkill because its meant for killing things that are frozen or unresponsive, if the app is still open i think /t with /f.

    i don't know without seeing this first hand and stepping through it myself because logically taskkill should just kill things because its supposed to kill the apps outright with no question.

    - - - Updated - - -

    Make sure you are targeting a parent process with the commands, that is another area where you could be going wrong.

    Some of the output you posted also has spaces in the names C:\Users\pintr>taskkill /IM NVIDIA Share.exe should be C:\Users\pintr>taskkill /IM "NVIDIA Share.exe" encapsulate these with "
      My Computer


  6. Posts : 16,962
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #16

    pintree3 said:
    The 5 below do exist so why does it say "not found"?
    C:\Users\pintr>taskkill /IM Start.exe
    ERROR: The process "Start.exe" not found.
    You could run the TaskList command to check whether or not a particular process is running.
    Start.exe, just for example, is only used to launch something else.

    You could write this check in for each item each time if you wanted.
    Code:
    tasklist | find /i "Start.exe" >nul && taskkill /t /f /IM Start.exe
    This command checks if Start.exe is running and, only if it is, it kills it.


    Denis
    Last edited by Try3; 17 May 2023 at 03:28.
      My Computer


  7. Posts : 1,191
    Windows 10
       #17

    That is just adding an extra conditional for no reason though. After thinking about it i don't think it really matters to check just tell it to kill directly by using task kill instead of asking, if it cannot find the app then there is either no app running or you have the name wrong.

    Sure both ways will work but i don't think you really need to check first because task kill is also searching. both ways are still going to produce the same outcome in that Start.exe is not terminating because it cannot find the application.

    They either got the names wrong for those errors or they are trying to kill something that does not exist.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 16:57.
Find Us




Windows 10 Forums