Some errors about running the command automatically before shut down


  1. Posts : 17
    Windows 7 Ultimate x64
       #1

    Some errors about running the command automatically before shut down


    A program often block the computer to shut down, so I want to run the command before shut down.

    I run the bat :
    Code:
     taskkill /f /im ZuoYou.exe
    And I do the follow







    But nothing happens, why?
      My Computer


  2. Posts : 6,285
    Windows 10 Pro X64
       #2

    The name shown in the error message is not ZuoYou.exe.

    The taskkill command /IM xxxxxxxxx has to be an exact match.

    What does tasklist in a Command Prompt window show the name to be?
      My Computer


  3. Posts : 17
    Windows 7 Ultimate x64
    Thread Starter
       #3

    Ztruker said:
    The name shown in the error message is not ZuoYou.exe.

    The taskkill command /IM xxxxxxxxx has to be an exact match.

    What does tasklist in a Command Prompt window show the name to be?
    Thanks for reply, and I think it is not the reason because if I run the command alone, it does kill the program.

    And the picture as follows.
      My Computer


  4. Posts : 17
    Windows 7 Ultimate x64
    Thread Starter
       #4

    I make the shut down command visible, and find it runs not before

    But after, that means I cannot automatically close the program when the window appears. So can anyone helps me to automatically close the program? Thanks
      My Computer


  5. Posts : 6,285
    Windows 10 Pro X64
       #5

    Perhaps the batch file needs to be run as Administrator? Not sure how you accomplish that in a shutdown sctipt though.
      My Computer


  6. Posts : 17
    Windows 7 Ultimate x64
    Thread Starter
       #6

    Ztruker said:
    Perhaps the batch file needs to be run as Administrator? Not sure how you accomplish that in a shutdown sctipt though.
    No, Now I know the mechanism, windows 7 runs the script only after it closes all the program. But Against the original intention. Because windows 7 cannot close the "Zuoyou", so it cannot run the script. And then I use the PS

    Code:
    stop-process -name ZuoYou
    Start-Sleep -s 1
    stop-computer -computername localhost

    and these measures are temporary. Now I am learning the Autohotkey, and it may help me run the command immediately when I press the 'shutdown' button.
      My Computer


 

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

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