如何关闭驱动器

时间:2016-03-12 13:18:20

标签: c++

我有一个代码可以取消隐藏可移动驱动器中的所有文件

//buffer is the removable drive letter
PWSTR show = L"/k attrib -s -r -h *.* /s /d /l ";
ShellExecute(NULL,L"open",L"cmd.exe",show,buffer,SW_HIDE);

此代码成功运行,但执行此操作后,我无法弹出可移动驱动器。 它显示以下消息 enter image description here

即使我关闭我的程序,它也会显示此消息。当看到任务管理器时,我发现我的驱动器I:\正在后台运行,我现在应该怎么做才能解决这个问题

1 个答案:

答案 0 :(得分:6)

开关/k使cmd.exe运行命令然后坐在那里等待进一步的指示。 您的shell窗口仍在那里,在后台隐藏,位于I:

/k替换为/c

/C     Run Command and then terminate

/K     Run Command and then return to the CMD prompt.
       This is useful for testing, to examine variables

http://ss64.com/nt/cmd.html)功能