如何有一个批处理文件创建另一个批处理文件 [英] How to have a batch file create another batch file
本文介绍了如何有一个批处理文件创建另一个批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让我的主要批处理文件创建另一个批处理文件。我的主要一个是在闪存驱动器,我希望它让另一个批处理文件将其弹出
让它退出的主要是容易的,我的问题是有主创建一个全新的批次和决定哪些命令进去吧
I'm want to make my main batch file create another batch file. my main one is in a flash drive, i want it to make another batch file to eject it having it eject the main is easy, my problem is having the main create a brand new batch and dictate which commands go in it
推荐答案
如果你需要多行,可以使用:
If you need multiple lines, you can use:
cat > newBashFile.sh << EOF
echo "first line"
echo "second line"
# multiple more commands, as long as they don't contain the string EOF
EOF
另一解决方案是:
Another solution would be:
echo -e "first command\nsecond command\n..." > bashFile.sh
这篇关于如何有一个批处理文件创建另一个批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文