【问题标题】:How do I hide and unhide specific text in a batch file?如何隐藏和取消隐藏批处理文件中的特定文本?
【发布时间】:2011-12-25 10:06:57
【问题描述】:

我正在制作一款基于生存的小型游戏。

现在我想知道的是如何隐藏特定的文本以使其不显示。

这是一个例子。

echo Character:
echo.
echo Your hunger level is %hunger% out of 100.

如果变量饥饿值等于 90,我想在下面显示:“你正在挨饿”,但当它更小时,我希望它根本不显示。

我该怎么做?

【问题讨论】:

  • 对不起。我鼓励您提出更清晰的问题,例如:“如何有条件地显示特定文本?”。因为“如何隐藏和取消隐藏特定文本?”正是这个意思,而且可以做到! ;-)

标签: scripting batch-file cmd hide show


【解决方案1】:
@echo off
SET VARIABLE=2
IF %VARIABLE%==1 echo "this should be shown if the variable is 1"
IF %VARIABLE% GTR 1 echo "this should be shown if the variable is less than 1"
IF %VARIABLE% LSS 1 echo "this should be shown if the variable is greater than 1"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-18
    • 2016-08-21
    • 1970-01-01
    • 2017-05-20
    • 2011-08-16
    • 1970-01-01
    • 2020-10-07
    相关资源
    最近更新 更多