How to pass a string to a Windows cmd that expects a file argument? [closed]

两盒软妹~` 提交于 2021-02-05 12:36:53

问题


Suppose a program cook takes one argument: the pathname of a text file containing the recipe of the food to cook. Suppose I wish to call this program from within a batch script, also suppose I already have the recipe in a string variable:

set the_recipe = "wash cucumbers" "wash knife" "slice cucumbers"

cook ...  # What should I do here? It expects a file, but I only have a string.

How can I pass the recipe to the command when it expects a filename argument?

I thought about creating a temporary file just for the purpose passing a file, but I wish to know if there are alternative ways to solve this problem.

(Adapted from Unix SE)

来源:https://stackoverflow.com/questions/66000360/how-to-pass-a-string-to-a-windows-cmd-that-expects-a-file-argument

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!