Batch file 我想使用符号作为变量的开始和结束标记
示例变量:Batch file 我想使用符号作为变量的开始和结束标记,batch-file,Batch File,示例变量: @echo off Color 0A cls setlocal enabledelayedexpansion :: read in input and set @ as start reading into a temp variable and set :: variable to %<input code>% with value of <begin command> i know how to :: read a line into a var
@echo off
Color 0A
cls
setlocal enabledelayedexpansion
:: read in input and set @ as start reading into a temp variable and set
:: variable to %<input code>% with value of <begin command> i know how to
:: read a line into a variable so i basically want to read all this from a
:: variable %line%
:: this portion will be handled each time the interpreter goes through a
:: line of text
echo %<input code>%. #<choice response>#
set /p choice="choice: "
if "%choice%"=="<input code>" !%choice%!
显示输出:
"%d%" == "start https://twitter.com/Lileaves/status/857465113363664896"
"%message%" == "Open In Browser"
消息将是一个临时变量,因为它将在菜单通过每行文本进行时被读入
我知道我可以写新行,但我需要让我的解释器知道显示代码和菜单代码之间的区别
另一个想法
::读入每行代码
如果“%line%”==“,则调用:readmenu
继续阅读菜单中的其他行
:readmenu
::读入下面三行代码
(但我不想使用这种格式)似乎使用
FOR/F
命令并在DELIMS
选项中使用这些符号就足够简单了。Mario你应该学会如何正确编辑代码。如果没有那么
关键字,只需省略它即可。否则,我完全同意@Squashman,如果可以选择格式,请使用一个简单的csv
(逗号分隔值)?如果可以,则使用else和csv可能是一个好主意。好吧,但我如何把它们读入变量呢。
"%d%" == "start https://twitter.com/Lileaves/status/857465113363664896"
"%message%" == "Open In Browser"
d. Open In Browser