Script to stop a program that runs at startup after 5 mins

Tuckstar84 0 Reputation points
2025-02-19T12:31:27.3233333+00:00

Hi. I have created a task in task scheduler to start my G.Skill RGB software at startup. I am now creating another task that I would like to close it after 5 mins of running. I have got as far as a second task set as at startup with a 5 minute delay and in the actions tab its asking for a program/script file. I have no idea where to start and my Google searches have let to complicated results that are beyond me as I have no experience writing scripts. Can anyone help please? The .exe file is located here "C:\Program Files (x86)\G.SKILL\Trident Z Lighting Control\Gaming.exe"

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,628 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. LISBOA 75 Reputation points Microsoft Employee
    2025-02-19T12:39:12.62+00:00

    Hello Tuckstar84

    I hope this message find you well.

    Thank you for reach out this channel.

    Please let me know if the following link it's helpful for the automation level you are looking for.

    https://learn.microsoft.com/en-us/power-automate/desktop-flows/getting-started-windows-11

    If this was helpful, please accept the answer :)

    0 comments No comments

  2. MotoX80 35,596 Reputation points
    2025-02-19T14:16:37.3666667+00:00

    Use this Powershell statement. Test it interactively first and verify that it works.

    get-process gaming | stop-process
    

    Here I have a cmd prompt running and I stop it.

    User's image

    Set the second task like this.

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.