I have a Windows .bat file which I would like to accept user input and then use the results of that input as part of the call to additional commands.
(我有一个Windows .bat文件,我想接??受用户输入,然后使用该输入的结果作为调用其他命令的一部分。)
For example, I'd like to accept a process ID from the user, and then run jstack against that ID, putting the results of the jstack call into a file.
(例如,我想接受来自用户的进程ID,然后针对该ID运行jstack,将jstack调用的结果放入文件中。)
However, when I try this, it doesn't work. (但是,当我尝试这个时,它不起作用。)
Here's my sample bat file contents:
(这是我的样本bat文件内容:)
@echo off
set /p id=Enter ID:
echo %id%
jstack > jstack.txt
and here's what shows up in jstack.txt:
(这是jstack.txt中显示的内容:)
Enter ID: Terminate batch job (Y/N)?
ask by translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…