Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a batch file that automatically builds, links and executes a .asm file?

Tags:

assembly

masm

I am working with DosBox emulator in my university. We build .asm files with MASM. I am extremely tired of having to build my .asm file every time with masm, then pressing enter 4 times, then entering link .obj, then enter 4 times. Then running the actual .exe. I wanted to automate this, and after searching for a while, I understand I need to make a batch file. It currently looks like this

@echo off

set arg1=%1
masm %arg1%.asm
%SendKeys% ("echo off{ENTER}")
%SendKeys% "echo off{ENTER}"
%SendKeys% "echo off{ENTER}"
%SendKeys% "echo off{ENTER}"
link %arg1%.obj
%SendKeys% "echo off{ENTER}"
%SendKeys% "echo off{ENTER}"
%SendKeys% "echo off{ENTER}"
%SendKeys% "echo off{ENTER}"
%arg1%.exe
%SendKeys% "echo off{ENTER}"

The SendKeys part doesn't work. When I searched online I was way overwhelmed by what I've found. I just want a simple way (if there is one) to simulate the four enter key pressed I have to manually do every time.

like image 704
Osama Nabih Avatar asked Feb 04 '26 06:02

Osama Nabih


1 Answers

You can place a semicolon ; on the end of masm.exe and link.exe command lines to make the programs use the default file names for the prompts.

like image 118
Michael Petch Avatar answered Feb 06 '26 03:02

Michael Petch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!