Jump to content
LaunchBox Community Forums

.bat through game starter options


5thWolf

Recommended Posts

  • 3 weeks later...

It looks like you can send keypresses via a batch file by incorporating Windows Scripting Host.  I've never tried this myself but looks intriguing and appears simple enough.  

@if (@CodeSection == @Batch) @then
@echo off
CScript //nologo //E:JScript "%~F0"
rem Run Your Game Here
goto :EOF
@end
WScript.CreateObject("WScript.Shell").SendKeys("1");

https://stackoverflow.com/a/25373908/11132805

 

 

  • Like 1
Link to comment
Share on other sites

To run ('start') your game (program), replace the Comment (rem [short for 'remark']) line with:

start "C:\Path\Program.exe"

If you're passing a parameter to the batch file, use:

start "" "C:\Path\Program.exe" %1

If you have multiple parameters, use: (example showing 3 parameters)

start "" "C:\Path\Program.exe" %1 %2 %3

 

The last line will press "1" on the keyboard for you which corresponds with "MOUSE" in your screenshot.  Hint: change "1" to "2" for JOYSTICK.

For a more thorough description of what's going on, click the link I gave you, and then click the 3rd link in his post ("Press Keyboard keys using a batch file").

BTW, I still haven't tested it and probably won't. So let us know when you get it working and what you came up with. ;) 

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, 5thWolf said:

Is this coding for DOS?

Ya. A batch file.  You can try opening the command prompt to the folder you have the batch file in and run the batch file from there to see what error(s) it gives.

If you have command line parameters to pass to it, be sure to add those.

image.png.363e5e90437b3b63bf298c48f2788a7e.png

  • Like 1
Link to comment
Share on other sites

OK, looks like I missed something here.  You're running the batch file from within DOSBox?  That's completely different and I know nothing about DOSBox.  Since DOSBox doesn't recognize "start", it probably won't recognize Windows Scripting Host commands either.  So looks like you're back to square one. Sorry.

  • Like 1
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...