且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

相当于 bash “expect"在 PowerShell 中

更新时间:2022-06-23 05:31:44

只是发布我的解决方案,以便它可以帮助某人.我在运行其他一些需要答案的脚本时遇到了同样的问题.首先创建一个文件inputFileLocation.txt",按顺序在每一行中包含每个问题的答案.然后以下面的语法运行脚本.它会完成工作.

Just posting my solution so that it can help someone. I faced the same problem while running some other script that will ask for answers. First create a file "inputFileLocation.txt" with answers to each question in each line in sequence. Then run the script in below syntax. And it will do the work.

`cmd.exe /c "script.bat < inputFileLocation.txt"`