Jump to content
LaunchBox Community Forums

.bat to run exe and submit few commands


5thWolf

Recommended Posts

With several DOS games once you run the EXE it ask for setup selections like this:

image.thumb.png.694180ad9c2a73074970d89265bfbaea.png

Anyone help me a make a DOS .bat file that runs the exe and hits the keys I choose.

Example:

start.exe
4
2
y

 

Edited by 5thWolf
Link to comment
Share on other sites

Adapted from here, this MIGHT work.  If nothing else, it gets you in the right direction of what you need to do.

@if (@CodeSection == @Batch) @then
@echo off
set SendKeys=CScript //nologo //E:JScript "%~F0"

start "" start.exe

ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "4"

ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "2"

ping -n 2 -w 1 127.0.0.1 > NUL
%SendKeys% "y"

goto :EOF
@end

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

The 2 in "ping -n 2..." is a 2 second 'pause'.  Adjust accordingly

 

It may (or may not) be easier to do this using an AutoHotkey script.

  • Thanks 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...