Learn when you want, where you want with convenient online training courses. Sign up now!
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
defrag <volume> /U
Open in new window
defrag /C /U
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
This course will introduce you to C++ 11 and teach you about syntax fundamentals.
REM Change this path if it is different on your computer.
set PROG=C:\Program Files\Defraggler\df.exe
REM Checks to make sure that the program is where the above path says it is.
if not exist "%PROG%" echo Defraggler Command Line Program Not Found. & pause & goto :EOF
REM Run the program with the /L switch to list accessible drives and exclude
REM the first few informational lines of what it would display.
REM For each line found, use only the first of the space-separated fields.
REM This will be the drive letter with the colon after it.
REM This FOR command is a loop that processes one line at a time, and
REM therefore one drive letter at a time before going on to the next.
REM Everything inside the brackets is the loop. When there are no more lines
REM from the results of the program's /L switch, it finishes.
for /f "skip=3 tokens=1 delims= " %%A in ('call "%PROG%" /L') do (
echo Defraggling !DRIVE!
echo call "%PROG%" !DRIVE! /QD
echo Finished Defraggling !DRIVE!
echo Press any key to continue with next drive, or Ctrl + C to exit ...
pause > nul
echo Press any key to quit ...
pause > nul
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.