1

Thank you, for those whom took the time to read my question. I am a gamer and would like to execute a few things. First, I would like to Trigger a batch file when I click a program, how do you do that or is it even possible? Basically, activating a game, triggers the batch file. NOw for the batch file problem, I want to execute Xpadder when I activate games (this is an mmo) and when I close the game I want Xpadder's process/service to close. Ultimately, it's auto trigger,activate,wait,terminate. That's kind of the process I want it to go if all can be done.

Batch File:

@echo off

start "Blade" "C:\Users\user\Documents\Blade.xpadderprofile" Blade.xpadderprofile

ECHO Blade.xpadderprofile STARTED

start /w "C:\Program Files (x86)\game\games.exe" games.exe

ECHO games STARTED

taskkill /f /im Xpadder.exe

This actually works but the problem is there are two ".exe" files with mmo's. I'll start the game and it would close Xpadder too early because one launcher starts another launcher/client. Xpadder works for the first launcher but the first launcher closes so the game will start. I hope I am explaining myself clear enough.

Reference link: How to automatically close App_A when I close App_B using batchfile

Essentially, this is the same question I have but it's not very clear. What is the batch code to get Xpadder to stay on until the second launcher/client is closed not the first one?

P.S The game has to open through the launcher then into the second launcher/client or it will not work. here is the other clients name and path i think:

C:\Program Files (x86)\game\gamer\bin\gam.exe
Community
  • 1
  • 1
prosystem
  • 11
  • 2
  • Check [my answer](http://superuser.com/a/849760/376602) to similar question – JosefZ Dec 13 '14 at 19:36
  • I apologize but I'm completely new to this...I should have been more clear about it. I don't understand your code, is there a simpler way or does it have to be like that. Remember though, it xpadder has to end when the second launcher/client ends not the first one. – prosystem Dec 13 '14 at 20:14
  • Just omit the `start /w ` in this line: `start /w "C:\Program Files (x86)\game\games.exe" games.exe` – JosefZ Dec 13 '14 at 20:31
  • That's what I had but it doesn't work. if i double click on the batch it will start the game and xpadder but then i have to go to the "play" button. When i go to the "play" button it closes that launcher and starts the game, which basically closes Xpadder because that launcher was closed. The game is apparently "client.bin" when it's in play rather than ".exe" So – prosystem Dec 13 '14 at 21:12
  • You could write a `goto` loop to run `tasklist /fi "WINDOWTITLE eq gamename" | find "gamename" && goto loop || taskkill /im "xpadder.exe" /f` with a `ping -n 11 0.0.0.0 >NUL` between `:loop` and `tasklist` to pause for 10 seconds every loop. You can try starting your game, hitting Play, then minimizing it (Win meta key + M) and look at the taskbar button to get its window title if you don't know it. – rojo Dec 15 '14 at 01:43
  • thx i'll try that right away. Hopefully it works. sorry it took so long to reply. – prosystem Dec 27 '14 at 21:12
  • ok what i had just doesn't look right to me. can you give me an example of what the coding will look like in Notepad using the info that i provided? – prosystem Dec 27 '14 at 21:30

1 Answers1

0

How about the use of the PsExec, a small MS ulility? Using it, your batch should work:

cmd /c psexec -d "Blade" "C:\Users\user\Documents\Blade.xpadderprofile" Blade.xpadderprofile  
start /w "C:\Program Files (x86)\game\games.exe" games.exe  
taskkill /f /im Xpadder.exe  

The file psexec.exe must be placed in folder enlisted in the system variable WINDIR or PATH, or, otherwise, you should call it with its full path, eg. *C:\Program Files\Others\pstools.exe".

You can add @echo off, salt, pepper or some green Tabasco if you have mon€y for this :D

MoE bis
  • 79
  • 1
  • 2