c# - C#如何在CMD中做出类似于SET /P的提示?
问题描述
如何在 CMD 中做出类似于 SET /P 的提示?
我正在尝试这样做:
(PATH VARIABLE): <user input here>
我将它用于我正在制作的 CMD shell 模拟器。
解决方案
使用此代码:
while (true)
{
Console.Write("My Command : ");
string input = Console.ReadLine();
if (input.ToUpper() == @"SET /P")
Console.WriteLine("command correct : " + input);
else
Console.WriteLine("command wrong : " + input);
}
推荐阅读
- ios - 如何使用 Swift 将具有角半径和阴影的 UIView .xib 加载到主视图控制器中
- java - 当我的条件为真时,为什么我的 if 循环被跳过?
- android - 拍照并命名
- string - 作为参数传递的字符串替换错误
- postgresql - Npgsql - 通知事件并附加有效负载
- android - 如何在设备启动时启动 android 应用程序?
- c# - PublicClientApplicationBuilder 和 TokenCacheHelper
- openmdao - 检查优化器是否支持梯度
- powershell - 如何使用powershell替换多个文件中的多行文本
- azure - Azure - 通过 ps 命令将 http 侦听器添加到现有的 ApplicationGateway