我有一个需要3个整数作为输入的.exe文件。例如:
myCode.exe < input.txt
在input.txt中:
2
3
8
现在我想将命令放入批处理文件中,我该如何编写批处理文件? (此处我想在批处理文件中传递3个固定整数)
谢谢!
我有一个需要3个整数作为输入的.exe文件。例如:
myCode.exe < input.txt
在input.txt中:
2
3
8
现在我想将命令放入批处理文件中,我该如何编写批处理文件? (此处我想在批处理文件中传递3个固定整数)
谢谢!
这也可能有效:
(
echo 2
echo 3
echo 8
) | mycode.exe
echo 1 2 3|mycode.exe
。 - dbenham试试这个:
run.bat:
myCode.exe %1 %2 %3
调用示例:
run.bat 111 222 333
使用文件:
run.bat < input.txt
myCode.exe
:echo 2 3 8 > output & myCode.exe output
type input.txt | myCode.exe
cat
不是本地的cmd
命令,而是Unix命令(type
命令基本上具有相同的功能,但选项较少)。 - Stephan