如何让批处理文件创建另一个批处理文件

时间:2014-12-22 18:30:29

标签: batch-file

我想让我的主批处理文件创建另一个批处理文件。我的主要是在闪存驱动器,我希望它制作另一个批处理文件以弹出它 让它弹出主要很容易,我的问题是主要创建一个全新的批次并指示哪些命令进入其中

2 个答案:

答案 0 :(得分:1)

如果您需要多行,可以使用:

cat > newBashFile.sh << EOF
echo "first line"
echo "second line"
# multiple more commands, as long as they don't contain the string EOF
EOF

另一种解决方案是:

echo -e "first command\nsecond command\n..." > bashFile.sh

答案 1 :(得分:0)

试试这个:

echo. content > newfile.bat
相关问题