问题
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