Code to run defrag

firewall_ie

Registered User.
Local time
Today, 21:10
Joined
Mar 31, 2003
Messages
20
Hi does any one know the code that can run with a command button that will let me start the likes of defrag and Disk clean
 
Defrag:

Private Sub YourButton_Click()
Application.FollowHyperlink "C:\WINNT\system32\dfrg.msc" 'Or where your dfrg.msc is
End Sub

Disk clean:

Private Sub YourButton_Click()
Application.FollowHyperlink "C:\WINNT\system32\cleanmgr.exe" 'Or where your cleanmgr.exe is
End Sub


IMO
 
is there modules to link
 
No, just add this line to the Onclick event of your button:

Application.FollowHyperlink "C:\WINNT\system32\dfrg.msc" 'Or where your dfrg.msc is

Or this line to another button OnClick event:

Application.FollowHyperlink "C:\WINNT\system32\cleanmgr.exe" 'Or where your cleanmgr.exe is


IMO
 
Did you change this part of the code

C:\WINNT\system32\dfrg.msc" 'Or where your dfrg.msc is

to the path where "dfrg.msc" is found?

IMO
 
yes that part is ok still giving the same error

I am using vb6 is that an issue
 
Check references, make sure none are missing. If you still get probs, post it and I'll take a look for you.

IMO
 
Last edited:

Users who are viewing this thread

Back
Top Bottom