在Windows应用程序编码中绕过DiskPart提示符. [英] Bypassing DiskPart Prompt in Windows application coding.

查看:69
本文介绍了在Windows应用程序编码中绕过DiskPart提示符.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行将Diskpart作为代码一部分的c#代码/批处理文件时,Diskpart提示符下的执行暂停或返回.诸如列表卷等的其他命令执行不会执行.有什么方法可以绕过Diskpart或继续执行进一步的命令.

On Executing a c# code/Batch file having Diskpart as a part of code, execution halts on Diskpart prompt or returns back. Further commands execution like list volume etc. doesn''t execute. Is there any way to bypass the Diskpart or to proceed to further commands execution.

System.Diagnostics.Process process1;
process1 = new System.Diagnostics.Process();
process1.EnableRaisingEvents = false;
string strCmdLine;
strCmdLine = "/C " + "List volume";
System.Diagnostics.Process.Start("Diskpart.exe", strCmdLine);
process1.Close();



[edit]添加了代码块-OriginalGriff [/edit]



[edit]Code block added - OriginalGriff[/edit]

推荐答案

可能的是,删除以下行:
Probably, taking out the line:
process1.Close();

将改善这种情况.
如果尚未完成,关闭进程也会终止该进程...

will improve the situation.
Closing a process also terminates it if it hasn''t finished...


这篇关于在Windows应用程序编码中绕过DiskPart提示符.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆