运行时更改批处理文件 [英] Changing a batch file when its running

查看:33
本文介绍了运行时更改批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个长时间运行的批处理文件.我现在意识到我必须在批处理文件的末尾添加更多命令(对现有内容没有更改,只是一些额外的命令).鉴于大多数批处理文件都是增量读取并一个一个执行的,是否可以这样做?还是系统读取文件的全部内容然后运行作业?

I am running a long running batch file. I now realize that I have to add some more commands at the end of the batch file (no changes to exisiting content, just some extra commands). Is it possible to do this, given that most batch files are read incrementally and executed one by one? Or does the system read the entire contents of the file and then runs the job?

推荐答案

我刚刚尝试过,并且违背我的直觉,它在最后(在 Windows XP 上)接收了新命令

I just tried it, and against my intuition, it picked up the new commands at the end (on Windows XP)

我创建了一个包含

echo Hello
pause
echo world

我运行了文件,并在它暂停时添加了

I ran the file, and while it was paused, added

echo Salute

保存并按回车继续暂停,所有三个提示都回显到控制台.

Saved it and pressed enter to contine the pause, all three prompts were echoed to the console.

所以,去吧!

这篇关于运行时更改批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆