问题描述
所以基本上我有一个需要用户输入很多的批处理文件。我不知道是否有可能有任何填充数据已经present如果问题是问,如果用户需要改变一些东西,他们可以编辑这些数据。例如:
So basically I have a batch file that requires alot of user input. I was wondering if it was possible to have any filler data already present when the question is asked, and if the user needs to change something, they can go edit that data. For example
然后将用户输入他们的名字和姓氏。
And then the user enter their first and last name.
但有可能开始一个缺省名称,用户可以回去和编辑,如果他们需要什么?
But is it possible to start with a default name that the user can go back and edit if they need?
这可能是没有必要的,但是,这是code我使用的用户输入。
This probably isn't necessary, But this is the code I use for the user input.
Set /p "Author=Please enter your name: "
和我理解的作者,将没有多大意义有preset的数据,但也有其他情况下在那里为我做到这一点的将是有益的。这可能吗?
And I understand for the Author it wouldn't make much sense to have preset data, but there are other instances where it would be useful for me to do this. Is it possible?
推荐答案
该方法有不便之处,屏幕必须在用户之前输入的数据被清除,但我正在试图解决这一点:
The method below have the inconvenience that the screen must be cleared before the user enter the data, but I am working trying to solve this point:
修改:我定的第一个版本的细节
EDIT: I fixed the detail of the first version
@if (@CodeSection == @Batch) @then
@echo off
rem Enter the prefill value
CScript //nologo //E:JScript "%~F0" "First Last"
rem Read the variable
echo -----------------------------------------------------------
set /P "Author=Please enter your name: "
echo Author=%Author%
goto :EOF
@end
WScript.CreateObject("WScript.Shell").SendKeys(WScript.Arguments(0));
有关详细信息,请参阅。
For further details, see this post.
这篇关于反正有没有在一个批处理文件,用户输入preset的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!