Jump to content
LaunchBox Community Forums

.bat file to start an exe


Johnny T

Recommended Posts

Anyone know of a .bat file that will simply start an exe. I want to run my Hidden Object Games but don't want to keep batch editing them to remove the emulator (as they don't use an emulator and just run natively on the PC).

I thought something like:

start D:\LaunchBox\Games\"Hidden Object Games"\%1\%1.exe

Might work but despite trying various options.... (start /d "" path) etc... I can't get it to work.

Anyone got any ideas?

Thanks :)

 

Link to comment
Share on other sites

Just import them as PC games not roms, that way a emulator isnt associated to them in the first place. Just drag and drop the .exe's onto Launchbox and choose the "none of the above" option in the wizard. This is the same way you import any file that doesnt need a emulator.

Link to comment
Share on other sites

5 minutes ago, neil9000 said:

Just import them as PC games not roms, that way a emulator isnt associated to them in the first place. Just drag and drop the .exe's onto Launchbox and choose the "none of the above" option in the wizard. This is the same way you import any file that doesnt need a emulator.

I'm an idiot. Didn't really think of that. I think I'm so used to just importing emulated games!!!

Okeedokee... That's the route I'll go down. 

Thanks ?

Link to comment
Share on other sites

8 hours ago, neil9000 said:

Just import them as PC games not roms, that way a emulator isnt associated to them in the first place. Just drag and drop the .exe's onto Launchbox and choose the "none of the above" option in the wizard. This is the same way you import any file that doesnt need a emulator.

Hi Neil

Just to let you know that I sorted that but, at first, it wouldn't allow me to drag/drop. It became apparent that it was because LB was run in 'admin' mode. Once I closed down and re-ran without admin mode it worked a treat.

Just posting here in case it catches someone else out (and probably to remind myself as well in the future! This brain ain't getting any younger!)

Thanks again :)

Link to comment
Share on other sites

9 hours ago, Johnny T said:

I'm an idiot. Didn't really think of that. I think I'm so used to just importing emulated games!!!

Okeedokee... That's the route I'll go down. 

Thanks ?

I realise this might be a tad late, but I think I also remember you asking about setting up ahk's for this type of game? By importing them as pc games I don't think you get the running ahk and exit ahk tabs that are in the edit emulator part.

Attached below is a bat file that hopefully will act as a launcher for the games for you.

Add an emulator, lets call it Hidden Objects for now

Set the tab as below-but obviously with your pathway and not mine-and no start up screens so can watch for issues

image.thumb.png.3247e83cbd9e7049093fae6ec63fe1be.png

Then you can use all the other tabs in this pic-once you have tested it and it works then you can tick attempt to hide box and use start up screens.

 

 

Edited by Kiinkyfoxx
Removed incorrect bat file
  • Thanks 1
Link to comment
Share on other sites

Mr Foxx you are a diamond!!!

I had literally just opened my AHK script to see what was going on as, you are correct, after importing the games this morning my AHK script didn't work (run)!!!

That's great info and you've saved a tiny bit of what little hair I have left.

Really appreciate you posting that matey :)

Link to comment
Share on other sites

9 minutes ago, Johnny T said:

Mr Foxx you are a diamond!!!

I had literally just opened my AHK script to see what was going on as, you are correct, after importing the games this morning my AHK script didn't work (run)!!!

That's great info and you've saved a tiny bit of what little hair I have left.

Really appreciate you posting that matey :)

 

No worries, hopefully it works out the box, but I haven't been able to test it, as don't have those games, but the theory behind it should work.

However if it doesn't it might be an issue with finding the correct path. In which case let me know and we can adapt it as needed, I think I may have actually over complicated it-just been thinking about it a tad more and realised that I may have got it wrong.

Without trying to be patronising, if it doesn't work then add a pause line as below-as I think this will be the bit that is wrong - it might be that the %Vara% bit isn't actually needed.

:LaunchEmu
cd %pathway%%Vara%

pause
start/wait /b %game%

 

Let us know the outcome-Cheers

Link to comment
Share on other sites

Yep, after standing on the shoulders of giants I ended up with this in order to get a working version.

set romname=%1

For %%A in (%romname%) do (
    Set Pathway=%%~dpA
    Set Game=%%~nxA
)

:LaunchEmu
cd %pathway%
"%game%"

My hidden object games have spaces in the name of the exe so had to put the %game% in quotes.

Also got rid of the echo'es as it was keeping the cmd prompt window open and refocussing on it after the game had launched.

Again, a big big thank you from me for pointing me in the right direction. I wouldn't have managed without your help.

Thanks :)

Link to comment
Share on other sites

3 hours ago, Johnny T said:

Yep, after standing on the shoulders of giants I ended up with this in order to get a working version.


set romname=%1

For %%A in (%romname%) do (
    Set Pathway=%%~dpA
    Set Game=%%~nxA
)

:LaunchEmu
cd %pathway%
"%game%"

My hidden object games have spaces in the name of the exe so had to put the %game% in quotes.

Also got rid of the echo'es as it was keeping the cmd prompt window open and refocussing on it after the game had launched.

Again, a big big thank you from me for pointing me in the right direction. I wouldn't have managed without your help.

Thanks :)

The annoying thing is that is actually the bat file I use on my system ?, and ended up adapting it and adding the Vara stuff to it as I used your one at the top as a start point, and after posting it realised I didn't need to add that bit-but it gave me a morning lesson in how to do something I didn't know before it bat files so all not lost.

 

I only put the echos is so could see what was going on- the launcher below has all the echos taken out AND will in theory stay open after loading the game so if you use start up and exit screens they will work with it.

On the edit emulator tab if you put a tick in the hide emulator box at the bottom it should stop any annoying grab from the bat file happening and also will hide is so nice and clean

 

 

Hidden objects launcher.bat

Edited by Kiinkyfoxx
replaced bat file with small correction
Link to comment
Share on other sites

For some reason the "start/wait" command doesn't work for me?? It doesn't start the game up? However, without the start/wait it does start the game??

I'm the same as you, a combination of Google and people like yourself and I'm always learning new things.

I'll continue to mess around with it and post back if I get it sorted. :)

 

Link to comment
Share on other sites

Right... I think it's sussed now.... it certainly seems to be working fine on the brief testing I've just done....

The batch file I use is called "NO EMULATOR REQUIRED SO DUMMY BAT FILE.bat" and it contains:

set romname=%1

For %%A in (%romname%) do (
    Set Pathway=%%~dpA
    Set Game=%%~nxA
)

:LaunchEmu
cd %pathway%
#start/wait /b "%game%"
"%game%"

My emulator settings are these:

emulator.thumb.PNG.8b51047b684ec4c4ddbca73faa712fcc.PNG

My "Running AutoHotKey Script" is:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, Force
#Persistent

$LCtrl::
Send, {LButton}

 

And my "Exit AutoHotKey Script" is:

ExitApp

 

And that seems to work!

A massive thanks again Foxxy for your help mate :)

Link to comment
Share on other sites

39 minutes ago, Johnny T said:

For some reason the "start/wait" command doesn't work for me?? It doesn't start the game up? However, without the start/wait it does start the game??

Because the %game% is in "" you might need to try the line below- there is a space between each bit-eg start{space}/wait{space}/b{space}""{space}"%game%" I think that because of the use of  "" around %game% it takes that as a window title, and then doesn't actually load anything

start /wait /b "" "%game%"

Edited by Kiinkyfoxx
Link to comment
Share on other sites

46 minutes ago, Kiinkyfoxx said:

Because the %game% is in "" you might need to try the line below- there is a space between each bit-eg start{space}/wait{space}/b{space}""{space}"%game%" I think that because of the use of  "" around %game% it takes that as a window title, and then doesn't actually load anything

start /wait /b "" "%game%"

Yep, adding the extra "" after /b and before "%game%" worked!!

What's the difference between just having "%game%" and having start /wait /b etc ??

Cheers :)

Link to comment
Share on other sites

The start /wait means that the command window stays open in the backgorund waiting for the game to close, before moving onto next command (which in this case is exit-well it would be but i am lazy and didn't bother putting it in so it auto exits) this is handy if you then want to close another programme, move any files etc after the game closes-I think it also helps with the exit screen being there when you exit the game.

 

Some of the launchers I have cobbled together will open other programmes before/move a config file around etc before loading the actual game (Lightgun games/Demul Emulator/Some others) and I need to put them back or close them afterwards, which is why I use the same style for all my bat files, and then when that specific game that needs something closes, it will run the next commands I have added to return things to how it was before-because it's not broke so I won't fix it.

 

the  /b basically means that no new command window opens when the command is passed-just keeps it all nice and tidy if like me you are OCD and don't like having other windows, boxes etc gettting in the way and stopping LB/BB looking good.

 

Edited by Kiinkyfoxx
Link to comment
Share on other sites

1 hour ago, Kiinkyfoxx said:

the  /b basically means that no new command window opens when the command is passed-just keeps it all nice and tidy if like me you are OCD and don't like having other windows, boxes etc gettting in the way and stopping LB/BB looking good.

 

Thanks for the explaination! And - yes! - I am like you and OCD :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...