Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: help with pc bat file  (Read 2824 times)

0 Members and 1 Guest are viewing this topic.

tony.silveira

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 697
  • Last login:September 27, 2024, 03:04:35 pm
    • my baby
help with pc bat file
« on: October 23, 2009, 12:18:42 am »
hi guys,

i was hoping someone could offer an assist.

i want to write a small bat file to launch a pc game thru my front end (mamewah) and have it also close xpadder.  i'm running into an issue when loading pc games in that some of them control wonky with my 360 pad and the key definitions i have set for my xpadder pc profile.

i know i can have multiple profiles for xpadder but since all my pc games launch with the same profile, i'm going to have to create a bat file to launch specific games and turn off xpadder; returning it to a standard 360 controller thru windows.

my confusion with the bat file is, will the bat file close upon exiting the loaded game or does it close once it's executed?

any input is appreciated,

tony

protokatie

  • I DO try to be insulting and horrible to my fellow Terran
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1396
  • Last login:March 27, 2012, 09:36:43 pm
  • Is anyone here a member of team retard?
Re: help with pc bat file
« Reply #1 on: October 23, 2009, 12:34:26 am »
Just a little info.
A batch file will "lock" on any particular line until the program it is running frees it (usually by being a windows program, or by ending).
CALLing a batch file from within a batch file will prevent the first batch file from ending prematurely (being cut off).

I know nothing of xpadder, but see if there is a /quit style command for it (run it in the command prompt with /? after it to see). If there is, you should be able to have that first in the batch file, then run the windows game. Might also want to check if the windows game releases the console(batch file) until after it is exited. If it waits until after you quit the game, you could have the third line on the batch file be for restarting xpadder. (All of this hinges on if xpadder can be given a command argument to have it quit itself)
--- Yes I AM doing this on purpose, and yes I DO realize it is pissing you off.

---If my computers were cats, my place would look like an old widows house, with half of the cats having obvious health problems

arzoo

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2093
  • Last login:January 26, 2025, 08:51:53 am
  • Robots WILL kill you.
    • LEDBlinky
Re: help with pc bat file
« Reply #2 on: October 23, 2009, 08:37:11 am »
tony - I would suggest using a vbscript. The trick is getting the windows handle for the running instance of xpadder. Search google for vbscript and "kill process" or "close application" and you should find examples.
Robots will kill you.



Arcade Addiction

axewater

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 23
  • Last login:February 07, 2013, 04:09:58 pm
Re: help with pc bat file
« Reply #3 on: October 30, 2009, 08:45:34 am »
great .. something *I* can help with !!! I'm the batch file MASTER :)
I'm going to assume you are using windows XP or later for this ...

modify this to your needs (ie the xpadder.exe filename I guessed) and save as batchfile.cmd :

@echo off
taskkill xpadder.exe /f
c:
cd \games\game1
start game.exe
exit


notes :
-taskkill.exe only exists on XP and later, i dont know what xpadder executable name is, but change this to your needs
-I recommend putting the lines 'c:' and 'cd .....blah' in the batch file to make sure the game will start from its own folder, or it might fail to run properly (as it cannot find the rest of the files)
-using START will make sure the batch file continues to the next line without waiting for the game to end
-the exit command is not really necesarry, but it wont do any harm and will make 100% sure the batch file closes while the game runs

good luck !

protokatie

  • I DO try to be insulting and horrible to my fellow Terran
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1396
  • Last login:March 27, 2012, 09:36:43 pm
  • Is anyone here a member of team retard?
Re: help with pc bat file
« Reply #4 on: November 01, 2009, 02:38:53 am »
YAY! I have a new batch command in my arsenal! How did I ever miss Taskkill* ?!!! Also, I thought they got rid of Run, and from what I understand they did; I seemed to have forgotten completely about the Start command being its replacement...   :banghead:


*Seriously, how come I have never heard of this before? I checked it (taskkill) out and now have a lot of new flexibility in my batch files...
--- Yes I AM doing this on purpose, and yes I DO realize it is pissing you off.

---If my computers were cats, my place would look like an old widows house, with half of the cats having obvious health problems

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: help with pc bat file
« Reply #5 on: November 02, 2009, 10:38:01 pm »
You should avoid taskkill.exe as much as possible because the process it kills will not exit "gracefully". I recommend a command line app such as process which can close an app using WM_CLOSE message which will allow the program to clean up and close properly.

axewater

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 23
  • Last login:February 07, 2013, 04:09:58 pm
Re: help with pc bat file
« Reply #6 on: November 03, 2009, 04:55:13 am »
nice one headkaze ... now I also have something new to use in batch files :)
so far I have not needed it, but I assume some games might only save highscore if you exit gracefully ...