如何解决QProcess 不启动 diskpart
我尝试使用 QProcess 来获取带有 diskpart 的信息,如下所示:
- 在文本脚本“list.txt”中,我写道:
list disk
-
在 cpp 中:
QProcess proc; proc.start("C:/Windows/system32/diskpart.exe",QStringList()<<"/s"<<""C:/Windows/system32/list.txt); proc.waitForFinished();
但是没有任何反应,因为我没有收到 Diskpart(用于 ACL)的对话框。 如果我添加 proc.waitForStarted() 来查看进程是否启动,我没有得到确认。
我也尝试单独启动 diskpart:
proc.start("C:/Windows/system32/diskpart.exe");
if (proc.waitForStarted())
ui->tText->append("Process started");
else ui->tText->append("Process not started");
proc.waitForFinished();
而我却“未开始”
如果我使用
system("diskpart");
diskpart 已启动。但我无法将脚本用于:
system ("diskpart /s "C:/Windows/system32/list.txt");
错在哪里?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。