defrag by clicking on shortcut, how?

  • Thread starter Thread starter Joel
  • Start date Start date
J

Joel

%windir%\system32\defrag.exe C:\ -f

I have this in the target line of a shortcut on my desktop, but when I run
it, it seems to only give me the status. I want to be able to click just one
time on a shortcut or bat file on my desktop to defrag my C drive. Isn't
there someway to do this?

Thanks.
 
Joel said:
%windir%\system32\defrag.exe C:\ -f

I have this in the target line of a shortcut on my desktop, but when I run
it, it seems to only give me the status. I want to be able to click just
one time on a shortcut or bat file on my desktop to defrag my C drive.
Isn't there someway to do this?

Thanks.

And you don't analyse the disk first, to see if it actually NEEDS
defragging? XP needs defragging very much less than the W9x versions,
particularly if your disk is formatted in NTFS....
 
The shortcut and the parameters are correct. When you run the shortcut, it defragments the drive, and provides you with a report similar to this:

- - -
C:\Documents and Settings\Ramesh>defrag c:\ -f
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.

Analysis Report
3.90 GB Total, 3.21 GB (82%) Free, 0% Fragmented (0% file fragmentation)

Defragmentation Report
3.90 GB Total, 3.21 GB (82%) Free, 0% Fragmented (0% file fragmentation)
- - -

Because you're the console utility from a shortcut, the Command window closes immediately before you can read the output. The job, however, is done correctly. To be sure, open a Command Prompt window and type:

defrag c: -f

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


%windir%\system32\defrag.exe C:\ -f

I have this in the target line of a shortcut on my desktop, but when I run
it, it seems to only give me the status. I want to be able to click just one
time on a shortcut or bat file on my desktop to defrag my C drive. Isn't
there someway to do this?

Thanks.
 
or you could add an addition line in the batch file with the pause command
so you can see the output before the window closes


The shortcut and the parameters are correct. When you run the shortcut, it
defragments the drive, and provides you with a report similar to this:

- - -
C:\Documents and Settings\Ramesh>defrag c:\ -f
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International,
Inc.

Analysis Report
3.90 GB Total, 3.21 GB (82%) Free, 0% Fragmented (0% file
fragmentation)

Defragmentation Report
3.90 GB Total, 3.21 GB (82%) Free, 0% Fragmented (0% file
fragmentation)
- - -

Because you're the console utility from a shortcut, the Command window
closes immediately before you can read the output. The job, however, is done
correctly. To be sure, open a Command Prompt window and type:

defrag c: -f

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


%windir%\system32\defrag.exe C:\ -f

I have this in the target line of a shortcut on my desktop, but when I run
it, it seems to only give me the status. I want to be able to click just one
time on a shortcut or bat file on my desktop to defrag my C drive. Isn't
there someway to do this?

Thanks.
 
Replied to [Ramesh, MS-MVP]s message :
Because you're the console utility from a shortcut, the Command window closes immediately before you can read the output. The job, however, is done correctly. To be sure, open a Command Prompt window and type:
defrag c: -f

Or change the target of shortcut to :
cmd /k defrag c: -f

Good Luck, Ayush.
 
Thank you all for replying. Ayush, what does your version do differently
from mine. I did not let it finish, but first impression is that it does the
same thing........

cmd /k defrag c: -f
 
Joel wrote ::
Thank you all for replying. Ayush, what does your version do differently
from mine. I did not let it finish, but first impression is that it does the
same thing........

cmd /k defrag c: -f

cmd /? :
/K Carries out the command specified by string but remains.

In this case, the string is [defrag c: -f] so when you run [cmd /k defrag
c: -f], the command prompt window runs the string and remains.




Good Luck, Ayush.
 
Back
Top