Auto Defrag Script

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking for a way to incorporate an auto defrag into the shutdown/logoff
via group policy. The command line is:

defrag c: -f
(forces defrag of C:\)

My problem is that when I reboot or logoff, it takes forever. Now this is
not a problem at the end of the day, but during the day I can't have it.

Is there a way to have the cmd window appear when the script runs so that I
can just close it out if I don't want it to run?
 
Try

cmd /k defrag c: -f

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
Thank you, but this didn't work. It just sits at the "Running Logoff Scripts"
until the defrag is done running. I also have these do system backups in the
logoff, but those come up with an interface that it can be cancelled with.
Any other ideas?
 
You might try using pause on the first line.

pause
defrag c: -f

Pause suspends processing of a batch program and displays the message
Press any key to continue . . .

While the command window is open waiting for a key to be pressed it can be
closed with the Close [X].

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
I forgot to add that when/if you want defrag c: -f to run, press any key to
continue.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Wesley Vogel said:
You might try using pause on the first line.

pause
defrag c: -f

Pause suspends processing of a batch program and displays the message
Press any key to continue . . .

While the command window is open waiting for a key to be pressed it can be
closed with the Close [X].

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Phil Buzzette said:
Thank you, but this didn't work. It just sits at the "Running Logoff
Scripts" until the defrag is done running. I also have these do system
backups in the logoff, but those come up with an interface that it can be
cancelled with. Any other ideas?
 
Sorry that didn't work either, but on a lighter note, I found something that
does work. I wrote a small program that asks the user if they want to defrag
before shutting down. "No" ends the program and the script is never ran.
Thank you for your help.

Wesley Vogel said:
I forgot to add that when/if you want defrag c: -f to run, press any key to
continue.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Wesley Vogel said:
You might try using pause on the first line.

pause
defrag c: -f

Pause suspends processing of a batch program and displays the message
Press any key to continue . . .

While the command window is open waiting for a key to be pressed it can be
closed with the Close [X].

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Phil Buzzette said:
Thank you, but this didn't work. It just sits at the "Running Logoff
Scripts" until the defrag is done running. I also have these do system
backups in the logoff, but those come up with an interface that it can be
cancelled with. Any other ideas?

:

Try

cmd /k defrag c: -f

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Phil Buzzette <[email protected]> hunted and
pecked:
I am looking for a way to incorporate an auto defrag into the
shutdown/logoff via group policy. The command line is:

defrag c: -f
(forces defrag of C:\)

My problem is that when I reboot or logoff, it takes forever. Now this
is not a problem at the end of the day, but during the day I can't have
it.

Is there a way to have the cmd window appear when the script runs so
that I can just close it out if I don't want it to run?
 
Since you have the skills to write programs, why didn't you do that in the
first places.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Phil Buzzette said:
Sorry that didn't work either, but on a lighter note, I found something
that does work. I wrote a small program that asks the user if they want
to defrag before shutting down. "No" ends the program and the script is
never ran. Thank you for your help.

Wesley Vogel said:
I forgot to add that when/if you want defrag c: -f to run, press any key
to continue.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Wesley Vogel said:
You might try using pause on the first line.

pause
defrag c: -f

Pause suspends processing of a batch program and displays the message
Press any key to continue . . .

While the command window is open waiting for a key to be pressed it can
be closed with the Close [X].

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Phil Buzzette <[email protected]> hunted and
pecked:
Thank you, but this didn't work. It just sits at the "Running Logoff
Scripts" until the defrag is done running. I also have these do system
backups in the logoff, but those come up with an interface that it can
be cancelled with. Any other ideas?

:

Try

cmd /k defrag c: -f

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Phil Buzzette <[email protected]> hunted and
pecked:
I am looking for a way to incorporate an auto defrag into the
shutdown/logoff via group policy. The command line is:

defrag c: -f
(forces defrag of C:\)

My problem is that when I reboot or logoff, it takes forever. Now
this is not a problem at the end of the day, but during the day I
can't have it.

Is there a way to have the cmd window appear when the script runs so
that I can just close it out if I don't want it to run?
 
oh no. I don't know how to write them that well. I am mid semester in a
begining programming course. I found mostly what I needed to do it online.

Wesley Vogel said:
Since you have the skills to write programs, why didn't you do that in the
first places.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Phil Buzzette said:
Sorry that didn't work either, but on a lighter note, I found something
that does work. I wrote a small program that asks the user if they want
to defrag before shutting down. "No" ends the program and the script is
never ran. Thank you for your help.

Wesley Vogel said:
I forgot to add that when/if you want defrag c: -f to run, press any key
to continue.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Wesley Vogel <[email protected]> hunted and pecked:
You might try using pause on the first line.

pause
defrag c: -f

Pause suspends processing of a batch program and displays the message
Press any key to continue . . .

While the command window is open waiting for a key to be pressed it can
be closed with the Close [X].

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Phil Buzzette <[email protected]> hunted and
pecked:
Thank you, but this didn't work. It just sits at the "Running Logoff
Scripts" until the defrag is done running. I also have these do system
backups in the logoff, but those come up with an interface that it can
be cancelled with. Any other ideas?

:

Try

cmd /k defrag c: -f

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Phil Buzzette <[email protected]> hunted and
pecked:
I am looking for a way to incorporate an auto defrag into the
shutdown/logoff via group policy. The command line is:

defrag c: -f
(forces defrag of C:\)

My problem is that when I reboot or logoff, it takes forever. Now
this is not a problem at the end of the day, but during the day I
can't have it.

Is there a way to have the cmd window appear when the script runs so
that I can just close it out if I don't want it to run?
 
Well, you learned something anyway. ;-) Keep having fun.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Phil Buzzette said:
oh no. I don't know how to write them that well. I am mid semester in a
begining programming course. I found mostly what I needed to do it online.

Wesley Vogel said:
Since you have the skills to write programs, why didn't you do that in
the first places.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Phil Buzzette said:
Sorry that didn't work either, but on a lighter note, I found something
that does work. I wrote a small program that asks the user if they want
to defrag before shutting down. "No" ends the program and the script is
never ran. Thank you for your help.

:

I forgot to add that when/if you want defrag c: -f to run, press any
key to continue.

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Wesley Vogel <[email protected]> hunted and pecked:
You might try using pause on the first line.

pause
defrag c: -f

Pause suspends processing of a batch program and displays the message
Press any key to continue . . .

While the command window is open waiting for a key to be pressed it
can be closed with the Close [X].

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Phil Buzzette <[email protected]> hunted and
pecked:
Thank you, but this didn't work. It just sits at the "Running Logoff
Scripts" until the defrag is done running. I also have these do
system backups in the logoff, but those come up with an interface
that it can be cancelled with. Any other ideas?

:

Try

cmd /k defrag c: -f

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In Phil Buzzette <[email protected]> hunted and
pecked:
I am looking for a way to incorporate an auto defrag into the
shutdown/logoff via group policy. The command line is:

defrag c: -f
(forces defrag of C:\)

My problem is that when I reboot or logoff, it takes forever. Now
this is not a problem at the end of the day, but during the day I
can't have it.

Is there a way to have the cmd window appear when the script runs
so that I can just close it out if I don't want it to run?
 
Back
Top