如何制作自动生成,链接和执行.asm文件的批处理文件? [英] How can I make a batch file that automatically builds, links and executes a .asm file?
问题描述
我在我的大学中使用DosBox模拟器.我们使用MASM构建.asm文件.我非常厌倦每次都必须用masm构建我的.asm文件,然后按Enter 4次,然后输入链接.obj,然后输入4次.然后运行实际的.exe.我想使它自动化,经过一段时间的搜索后,我知道我需要制作一个批处理文件.当前看起来像这样
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}"
SendKeys部分不起作用.当我在线搜索时,发现的东西让我不知所措.我只想要一种简单的方法(如果有的话)来模拟我每次必须手动执行的四个回车键.
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.
推荐答案
您可以在masm.exe
和link.exe
命令行的末尾放置分号;
,以使程序使用提示的默认文件名
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.
这篇关于如何制作自动生成,链接和执行.asm文件的批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!