不行啊!2000下不是exe(defrag.exe),怎么办?

解决方案 »

  1.   

    请先为你的程序添加一个标准模块,然后添加以下语句:Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long在Form1上添加一个按钮,在其单击事件中添加以下代码:Dim sSave As String, ret As Long
    sSave = Space(255)
    ret = GetSystemDirectory(sSave, 255)
    sSave = VBA.Left$(sSave, ret)
    ret = Shell(sSave + "\mmc.exe" + " " + sSave + "\dfrg.msc", vbNormalFocus)单击按钮即可打开碎片整理程序。
      

  2.   

    或者简化如下:在Form1上添加一个按钮,在其单击事件中添加以下代码: Shell "C:\WINNT\System32" + "\mmc.exe" + " " + "C:\WINNT\System32" + "\dfrg.msc", vbNormalFocus这样也可以打开。