Jump to content

Defrag


kenbo
 Share

Recommended Posts

Hi

Can anybody have a look at this and tell me what I;m doing wrong?

RunWait("%windir%\system32\dfrg.msc")

Error is = "Unable to execute the external command"

I have also used "Run" to no avail.

Help

B)

dfrg.msc is not an executable. Try using defrag.exe.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

No can do. Still getting the same error.

See this Topic in Scripts and Scraps, it will do what you want or give you some ideas.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

AutoIt won't expand environment variables unless you explicitly tell it to:

Opt('ExpandEnvStrings', 1)

I would suggest grabbing SlimShady's _ShellExecute() UDF which would allow you to do this:

_ShellExecute(EnvGet('SystemRoot') & '\System32\dfrg.msc')

Or you could do it this way:

Opt('ExpandEnvStrings', 1)
RunWait('%SystemRoot%\System32\mmc.exe "%SystemRoot%\System32\dfrg.msc"')
Link to comment
Share on other sites

  • 5 years later...

This is how you defragment a hard drive using domain credentials on XP...

Btw... I LOVE AUTOIT ! ! !

Normal users don't need administrator rights to defrag - and they wont bug you.

Not recommended to have credentials in there... but hey, it works and what do you do...

All the user has to do is click on the compiled exe and defrag! Works in my case!

:huh2:

#AutoIt3Wrapper_Icon=defrag.ico
#AutoIt3Wrapper_Run_Obfuscator=Y #Obfuscator_Parameters=/CV /CF /CS /CN
RunAsWait("mydomainusername", "mydomain.org", "mydomainpassword", 0, "mmc.exe dfrg.msc", @SystemDir)

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...