Command-line examples
Following are several WinContig command-line examples.
Basic operations
Run the following command to defragment all files located in the c:\data folder and related subfolders.
Run the following command to defragment all files located in the c:\data folder and related subfolders without checking for disk errors and without deleting temporary files.
Run the following command to defragment all files located in the c:\data folder excluding subfolders.
Run the following command to analyze all files located in the c:\data folder and related subfolders to determinate how fragmented the files are.
Run the following command to defragment only executable files located in the c:\data folder.
Run the following command to defragment only executable files located in the c:\data folder and related subfolders.
Run the following command to analyze only executable files and document files located in the c:\data folder and related subfolders.
Run the following command to defragment all files located in the c:\data folder and related subfolders, and automatically close WinContig once the defragmentation process has been completed.
Run the following command to defragment all items listed in the c:\data\myprofile.wcp profile.
Run the following command to defragment all files located in the c:\data folder and related subfolders without showing the user interface of WinContig.
Advanced operations
Run the following command to move only executable files located in the c:\data folder to the fast access zone of the volume. If a file cannot be moved to the fast zone of the volume, that file will be skipped.
Run the following command to move only executable files located in the c:\data folder
to the fast access zone of the volume. If a file cannot be moved to the fast zone of the
volume, WinContig will try to move that file to the first available contiguous run of free clusters that is
large enough to contain the entire file.
Notice the use of the asterisk (*
) in the /diskzone
switch.
Run the following command to move all files located in the c:\data folder
and related subfolders to the first available contiguous run of free clusters that is large enough to contain
an entire file starting from the disk cluster 1234.
Notice the use of the asterisk (*
) in the /diskzone
switch.
Batch script example
When using the /nogui
switch, WinContig provides exit codes that indicate the level
of success for a command. You can create a batch script to perform an operation and use the script if
command to process the exit code if an error occurs.
Check the following batch script example to learn how to process exit codes.
:: Defragment all files located in the 'c:\data' folder and related subfolders.
:: The disk is automatically checked for errors.
wincontig "c:\data" /defrag /chkdsk:1 /nogui
if errorlevel 5 goto notfound
if errorlevel 3 goto incomplete
if errorlevel 2 goto diskerror
if errorlevel 0 goto success
:: the specified folder does not exist.
:notfound
echo.
echo WinContig cannot find the specified folder.
echo The defragmentation operation has been canceled.
exit /b 0
:: one or more files have not been defragmented.
:incomplete
echo.
echo WinContig was unable to successfully defragment all files.
echo Some files are still fragmented.
exit /b 0
:: errors were found during the checking of the disk.
:diskerror
echo.
echo WinContig has detected problems with the disk.
echo The defragmentation operation has been canceled.
exit /b 0
:: all files have been defragmented.
:success
echo.
echo Defragmentation successfully completed.