开发者

How to open a command prompt window in ruby script and have an interactive session

I have a requirement where i need to open command prompt and run a bat file, this bat file will ask for the user to enter a choice 2 to 3 times, how to automate this in ruby in windows开发者_开发问答.

Am able to open command prompt using

system("start cmd.exe")

After this I need to change directory and then i need to run the file present in c://temp//dat.bat, through ruby script.

Please let me know how to automate all these operations.


cmd_line = "cmd.exe /c \"cd #{directory}&&#{bat_file}\""
system(cmd_line) # if you're not interested in the output

Should do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜