运行cmd命令后,需要输入帐号和密码,然后使用C#关闭它

时间:2017-04-11 03:20:04

标签: c#

我需要在命令行中输入帐户和密码。我怎样才能做到这一点?我正在使用以下代码。

    Process process = new Process();
    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.FileName = @"cmd.exe";
    startInfo.Arguments = @"/k" + Commmand;
    process.StartInfo = startInfo;
    process.Start();

以下是cmd流程产生的预期提示:

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

您必须拥有"用户"的数据库,其中包含用户名和密码。 在命令行中询问用户所需的输入并与您一起检查密码。 DB可以是在您的情况下允许的anithing。例如简单的List或类似的smth。

相关问题