自动运行.BAT用命令 [英] Automated running .bat with commands
问题描述
我有如下的automated.bat:
I have a automated.bat with the following lines:
cd C:\Users\user\Downloads\megatools-1.9.97-win64\megatools-1.9.97-win64\
megacmd.bat
megals /Root --username username@email.domain --password password
megamkdir /Root/testmake2 --username username@email.domain --password password
它会高兴地说megacmd.bat是Megatools外壳,但它不会excecute下面的命令。
It will happily say the megacmd.bat is Megatools Shell, but then it won't excecute the commands that follow.
我想它可能是因为megacmd.bat是在不同的编程语言,因此进来的命令是无效的。
I figured it might be because the megacmd.bat is in a different programming language, hence the incomming commands aren't valid.
所以,我试图用,以适应这一切在1号线:
So I tried to fit it all in 1 line with:
cd C:\Users\a\Downloads\megatools-1.9.97-win64\megatools-1.9.97-win64\
megacmd.bat & megals /Root --username username@email.domain --password password & megamkdir /Root/testmake2 --username username@email.domain --password password
但没有做的任何命令,所以无论我也试过:
but that didn't do anything with the commands either so I also tried:
cd C:\Users\a\Downloads\megatools-1.9.97-win64\megatools-1.9.97-win64\
megacmd.bat & "megals /Root --username username@email.domain --password password" & "megamkdir /Root/testmake2 --username username@email.domain --password password"
和
cd C:\Users\a\Downloads\megatools-1.9.97-win64\megatools-1.9.97-win64\
megacmd.bat "megals /Root --username username@email.domain --password password" & "megamkdir /Root/testmake2 --username username@email.domain --password password"
和
cd C:\Users\a\Downloads\megatools-1.9.97-win64\megatools-1.9.97-win64\
megacmd.bat megals /Root --username username@email.domain --password password & megamkdir /Root/testmake2 --username username@email.domain --password password
但我似乎无法得到正确的语法。什么是有megacmd.bat运行和连续地执行上述两个命令的命令?
But I can't seem to get the syntax right. What would be the command to have the megacmd.bat run and execute the above 2 commands consecutively?
推荐答案
您行
megacmd.bat
启动 megacmd.bat
并将控制权交给它。它永远不会返回到你的 automated.bat
。
starts megacmd.bat
and gives control to it. It never returns to your automated.bat
.
您应该
call megacmd.bat
要控制返回给你的第一个的.bat
在 megacmd.bat
结束。
to return control to your first .bat
after megacmd.bat
finishes.
这篇关于自动运行.BAT用命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!