标题: Set Choice=%Choice:~0,1%是什么意思 [打印本页] 作者: freesoft00 时间: 2009-8-30 08:04 标题: Set Choice=%Choice:~0,1%是什么意思 ::Set Choice=
Set /P Choice= 请选择要进行的操作 (1/2/Q) ,然后按回车:
If "%Choice%"=="" Goto Start
If Not "%Choice%"=="" Set Choice=%Choice:~0,1%
If /I "%Choice%"=="1" Goto INSTALL
If /I "%Choice%"=="2" Goto UNINSTALL
If /I "%Choice%"=="Q" Exit
Goto Start
set str=%str:~x,y%,表示从第x+1位起,截取%str%值的y个字符,赋予变量str。作者: wowfans 时间: 2009-8-30 14:18
楼主在命令行打一下SET /?
什么都有了
The /P switch allows you to set the value of a variable to a line of input
entered by the user. Displays the specified promptString before reading
the line of input. The promptString can be empty.
Environment variable substitution has been enhanced as follows:
%PATH:str1=str2%
would expand the PATH environment variable, substituting each occurrence
of "str1" in the expanded result with "str2". "str2" can be the empty
string to effectively delete all occurrences of "str1" from the expanded
output. "str1" can begin with an asterisk, in which case it will match
everything from the beginning of the expanded output to the first
occurrence of the remaining portion of str1.
May also specify substrings for an expansion.
%PATH:~10,5%
would expand the PATH environment variable, and then use only the 5
characters that begin at the 11th (offset 10) character of the expanded
result. If the length is not specified, then it defaults to the
remainder of the variable value. If either number (offset or length) is
negative, then the number used is the length of the environment variable
value added to the offset or length specified.
%PATH:~-10%
would extract the last 10 characters of the PATH variable.