11-23-2019, 10:07 PM
(This post was last modified: 12-13-2020, 09:43 PM by darklinkpower.)
This tutorial will show you how to to run an executable when launching a game and close it after exiting a game.
Tutorial on Playnite Wiki: https://github.com/JosefNemec/Playnite/w...s#examples
Instructions
1a. If you want the executable to run only for a particular game: Open the Edit Game Details (With F3 or right click+Edit...) and go to the Scripts tab
1b. If you want the executable to run only for all your games: Open the Scripts submenu in the Settings Window (With F4 or Main menu --> Settings... --> Scripts)
2. Select Powershell in the Script Runtime dropwdown menu
3. Paste the following in the "Execute before starting game" text box and replace the path and executable name for the one you want to use
3. Paste the following in the "Execute after exiting game" text box and replace the ProcessName for the process name of your executable.
You can easily check the process name in Task Manager:
In case you start the process with elevated rights, use the following instead replacing the name of the executable:
4. Save and exit
Example on how it should look
Tutorial on Playnite Wiki: https://github.com/JosefNemec/Playnite/w...s#examples
Instructions
1a. If you want the executable to run only for a particular game: Open the Edit Game Details (With F3 or right click+Edit...) and go to the Scripts tab
1b. If you want the executable to run only for all your games: Open the Scripts submenu in the Settings Window (With F4 or Main menu --> Settings... --> Scripts)
2. Select Powershell in the Script Runtime dropwdown menu
3. Paste the following in the "Execute before starting game" text box and replace the path and executable name for the one you want to use
Start-Process "c:\path\to\your\executable\Executable.exe"
3. Paste the following in the "Execute after exiting game" text box and replace the ProcessName for the process name of your executable.
Stop-Process -Name ProcessName
You can easily check the process name in Task Manager:
In case you start the process with elevated rights, use the following instead replacing the name of the executable:
(Get-WmiObject -Class Win32_Process -Filter "name = 'Executable.exe'").Terminate()
4. Save and exit
Example on how it should look