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

给你一囗甜甜゛ 提交于 2019-12-01 23:53:29

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/47367709/how-can-i-make-a-batch-file-that-automatically-builds-links-and-executes-a-asm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!