# Command Line Options

Navigation: Using Scheduled TreeSize Tasks > # Command Line Options |

The Professional Edition of TreeSize accepts command line options enabling you to run scheduled scans or to have the results of a scan on your monitor the next morning. The Schedule dialog will help you compile a command line with the options below. Please note: These option are not available in the Personal Edition.

Treesize.exe [/OPTION] SCANPATH

### /? or /HELP | Shows this help page.
### /AGEOFFILES | Saves the graph on the "Age of Files" tab of the scanned directory to a bitmap, GIF, PNG, JPEG, Text, or CSV file. The file type depends on the extension of the specified file name. The following example creates a JPEG image file of the"Age of Files" graph for your local drive C: Treesize /SCAN "C:\" /AGEOFFILES "C:\Documents\c_file_ages.jpg"
### /APPENDTOFILES <value> | With this option, you can select whether or not TreeSize should append its output to existing files when doing an export, e.g. when using /TEXT. Select "True" to append and "False", if you want to overwrite existing files. Please note: This parameter will not work with exported images, XML and PDF files. Those files always will be overwritten. You can use the switch /DATE to ensure that all generated reports will have a unique file name. When exporting to an Excel file via /EXCEL, this parameter can be used together with /SHEETNAME to append the data to the specified sheet. Example: Treesize.exe /SCAN "C:\" /APPENDTOFILES True /EXCEL "C:\Export.xlsx" /SHEETNAME "test" Treesize.exe /SCAN "C:\" /APPENDTOFILES False /TEXT "C:\Export.csv"
### /ARCHIVEBITFILESONLY | This option will include only files for which the archive bit set in the scans. This option can be very useful if you want to calculate the size of a backup. In this case, you can create a shortcut on your desktop or in your start menu that will automatically start calculating the size of your backup. Example: Treesize /ARCHIVEBITFILESONLY /SCAN "\\Server\Backup\This"
### /ATTACH | If specified, all exported files will be attached to the email. If not specified, files with an explicitly given path are not attached. This is useful in case you XML or Excel files are getting quite large and fill up you email account. This example will export to an Excel file but not attach it to the mail: TreeSize.exe /SCAN "F:\" /EMAIL "treesize@example.com" /EXCEL "C:\Temp\test.xlsx" These examples will attach the Excel file to the email: TreeSize.exe /SCAN "F:\" /EMAIL "treesize@example.com" /EXCEL TreeSize.exe /SCAN "F:\" /EMAIL "treesize@example.com" /ATTACH /EXCEL "C:\Temp\test.xlsx"
### /BARCHART <filename> | Saves the bar chart of the scanned directory to a bitmap, GIF, PNG, or JPEG file. The file type depends on the extension of the specified file name. This example creates a PNG image file of the bar chart for your local drive C: Treesize /SCAN "C:\" /BARCHART "C:\Documents\c.png"
### /COMPARE <filename|path> | Compares the scanned path with a saved index file. The following example scans drive C: and compares the result with a saved XML report for this drive: Treesize /COMPARE "C:\Reports\TreeSize\c.xml.zip" /SCAN "C:\" Instead of an index file, you can also use a path with this command line parameter. The given path will be compared with the current scan result. The following example scans drive C:\ and additionally uses the path D:\Backup_of_C to perform a comparison between the two: Treesize /SCAN "C:\" /COMPARE "D:\Backup_of_C" Alternatively, you can compare two already existing index files e.g. "c1.xml.zip" and "c2.xml.zip" by using this command : Treesize /OPEN "C:\Reports\TreeSize\c1.xml.zip" /COMPARE "C:\Reports\TreeSize\c2.xml.zip" The /OPEN command prepares the comparison of the two files by expanding the first file ("c1.xml.zip") into a scan file. The second file ("c2.xml.zip") will be compared to this expanded scan file, just like it would happen, if "c2.xml.zip" was compared to a "real" scan.
### /COPY <path> | This option can only be used in combination with the command line option /SEARCH. Copies the results of a TreeSize file search to the target location. The following command will search on your local drive C: using the latest search options and copies the search results to the folder "C:\temp\ObsoleteFiles": Treesize /SEARCH:Start /SCAN "C:\" /COPY "C:\temp\ObsoleteFiles" See also: File operations
### /CREATEDPASTDAYSONLY <n> | This option will include only files in the scans, which were created during the number of days entered in the argument. In the following example, this option will only include only files created during the last eight days in the scan: Treesize /CREATEDPASTDAYSONLY 8
### /CREATESNAPSHOT <drive> | Creates a snapshot for the drives that are given after this command line paramter. Example: Treesize /CREATESNAPSHOT "C:\" "D:\" Creating snapshots may require administrative privileges.
### /CSV <filename> | Saves the results to a CSV file after the scan or search is finished. The application will terminate itself after saving. This example will save the results of a File Search on your local drive C: with the last search configurations to a CSV file: Treesize /SEARCH:Start /SCAN "C:\" /CSV "C:\Results\C_search.csv"
### /DATE | This switch will add the current date and time to all export file names in the command line. This is useful if you want to do scans regularly, e.g. every night or every weekend. The following example will scan the network path "\\Host\Share" and save the result to a file like "C:\Scans\name_2013-08-14_17-18-24.xls": Treesize /SCAN "\\Host\Share" /DATE /EXCEL "C:\Scans\name.xls"
### /DEDUPLICATE | This option can only be used in combination with the command line option /SEARCH. It will replace the duplicate files that were found by the TreeSize duplicate file search with NTFS hardlinks: Treesize /SEARCH:Start /SCAN "C:\" /DEDUPLICATE
### /DELETE | This option can only be used in combination with the command line option /SEARCH. Permanently deletes all files that have been found as result of a TreeSize file search. Example: Treesize /SEARCH:Start /SCAN "C:\temp" /FILTER "*.tmp" /DELETE See also: File operations
### /EMAIL <recipient> | Sends the collected data to the given email address. This parameter can be used only once on the command line, and only one email with all results will be sent. Multiple recipients can be separated with semicolons (;) or commas. To send emails via the command line, you need to specify valid SMTP settings on the corresponding page in the TreeSize options dialog. Example: Treesize /SCAN "\\Server\Share" /EMAIL "treesize@example.com" If no other parameters have been specified, the email will be sent in the format that is set in the options (HTML or plain text). If you would like to define the format independent from the current options, you can use the parameters /TEXT or /HTML right behind the definition of the recipient address(es). Example: Treesize /SCAN "\\Server\Share" /EMAIL "treesize@example.com" /TEXT By combining parameters you can also add attachments to the email. The following example will add an Excel report of the scan as an attachment to the email: Treesize /SCAN "\\Server\Share" /EMAIL "treesize@example.com" /EXCEL
### /EMAILIFRESULTSFOUND | This option can only be used in combination with the command line options /SEARCH and /EMAIL. If this parameter is specified, TreeSize will only send an email with the current search results, if at least one file or folder has been found during the search, by any of the specified search types.
### /EMPTYRECYCLEBIN | If you use this option, TreeSize will empty the recycle bin before running the current scan. Example: Treesize /EMPTYRECYCLEBIN /SCAN "C:\"

### /EXECUTE <filename> | This option can only be used in combination with the command line option /SEARCH. This parameter allows passing files that have been found by the TreeSize file search to another application or script. A possible target for this parameter can be a batch, or a powershell script. The following example will search drive C:\ with the most recent search settings and call the script "Archive.bat" for each file that has been found. The file will be passed to the script as command line parameter: Treesize /SEARCH:Start /SCAN "C:\" /EXECUTE "C:\Scripts\Archive.bat" See also: File operations
### /EXCEL <filepath> | Exports the collected data in Microsoft Excel format and saves it under the entered file path. If only a file name is specified, the current installation directory is used to store the export. Supported formats are the conventional .XLS file format (Excel 97-2003) as well as the .XLSX format (introduced with Excel 2007). The used format depends on the extension of the specified file name. The application will terminate itself after saving. Example: Treesize /SCAN "C:\" /EXCEL "C:\Documents\c.xls" If the file name already exists, the file will be opened and a new worksheet will be added. Please note: In the TreeSize File Search (/SEARCH) the results of each search type are collected in their own specific worksheet. If the file under the given path already exists, these sheets will be overwritten. To prevent this, you need to use the command line option /APPENDTOFILES.
### /EXCLUDE <pattern1;pattern2> | This option enables you to specify patterns for files and folders that should be excluded from a scan. Multiple exclude patterns can be separated using a semicolon (;). If one or more of the patterns contain spaces, the complete pattern string must be set into quotes ("). The following example will ignore files and folders that end with ".tmp" or where the exact name is "system": Treesize /SCAN "\\Server\Users" /EXCLUDE "*.tmp;system"
### /EXPAND <level|size> | This option lets you specify how many levels in the directory tree will be expanded after scanning. If you don't specify a number after this option, all folders will be expanded. Instead of a directory level you can also indicate an amount in Mega Byte (MB). In this case all folders larger than the given amount will be expanded. The unit "MB" must follow the number without a blank. The following example will scan the folder "H:\User", expand all folders larger than 10 MB and save the result to the Excel file "C:\Results\Allusers.xlsx": Treesize /SCAN "H:\User" /EXCEL "C:\Results\Allusers.xlsx" /EXPAND 10MB
### /EXPANDABLEREPORT <value> | If this option is used, Excel exports will use expandable/collapsible groups that can be navigated similar to the directory tree. Treesize /SCAN "H:\User" /EXPANDABLEREPORT True /EXCEL "C:\Results\Allusers.xlsx" Treesize /SCAN "H:\User" /EXPANDABLEREPORT False /EXCEL "C:\Results\Allusers.xlsx"
### /EXPORTDRIVESLIST <filename> | This option enables you to export the contents of the "Drive List" to an Excel, Text, or CSV file. The file type depends on the extension of the specified file name. Example: Treesize /SCAN "C:\Results\AllDrives.csv" /EXPORTDRIVESLIST
### /EXPORTFILES | If specified, files will be included in all exports. So this option is equivalent to activating the option "Tools > Options > Export > * > Exported elements > Folders and single files"
### /EXPORTGROUPSEXPANDED | if specified, the export of the extensions list will contain all information about the extensions contained within groups.
### /EXPORTPATHSLIST <filename> | This option can only be used in combination with the command line option /SEARCH. Exports a simple list that contains all search results. The list will contain only the full paths of the search results and no other information. Supported formats for the destination file are .txt and .csv. This example will search for, and create a list of all exe files on drive C: Treesize /SEARCH:Start /SCAN "C:\" /FILTER "*.exe" /EXPORTPATHSLIST "C:\Results\SearchResults.csv" It can be used to import results of a previous search back into the user interface, by using "File > List of paths > Import path list", or the parameter /IMPORT. If the option "Tools > Options > Export > Include duplicate groups" is activated, you can also use this function to export and import results of the duplicate search including their group structure.
### /EXPORTTITLE <title> | Can be used to change the title within a printed report or exported file. This allows you to supply additional information to the user when using TreeSize in an automated environment. The use of environment variables is allowed as well. Example: Treesize /SCAN "\\Server3\C$" /EXPORTTITLE "This is drive C on Server3" /PRINT
### /EXTENSIONSLIST <filename> | This option enables you to save the statistics on file extensions / file types of the scanned file system branch to an Excel, HTML, Text, or CSV file. The file type depends on the extension of the specified file name. The exported columns will be those that were enabled in the user interface on the tab "Extensions" when it was last used, or at the time when the configuration file supplied via /OPTIONS was written. The following example scans drive C: and creates an Excel file named "D:\TreeSize Reports\C_filetypes.xls" with the statistics of the file types on this drive: Treesize /SCAN "C:\" /EXTENSIONSLIST "D:\TreeSize Reports\C_filetypes.xls"
### /EXTENSIONSCHART <filename> | Saves the small graph shown on the bottom of the "Extensions" page to an image file (bitmap, GIF, PNG, or JPEG).
### /EXTENSIONSPIECHART <filename> | Saves a piechart that shows the distribution of "file extensions" to an image file (bitmap, GIF, PNG, or JPEG).
/FILTER <pattern1;pattern2> | Sets a file filter counting only files with certain extensions, e.g. ".mp3" or ".doc". Multiple patterns may be passed, separated by semicolon (;). The following example will search for MP3 and AVI files in the "Users" directory on the server: Treesize /SCAN "\\Server\Users" /EXCEL "C:\Results\UsersMediaFiles.xlsx" /FILTER "*.mp3;*.avi" When performing a TreeSize File Search (/SEARCH), you can also use the /FILTER command line switch to specify the patterns of the advanced file search. To perform a more complex custom file search you should save the search options to a file and pass the resulting XML file to the command line after /SEARCH.
### /FOLLOWREPARSEPOINTS | If this switch is added to the command line, TreeSize will follow mount points and external symbolic links when scanning a file system tree.
### /GROUPSCANS | Using this command line switch will group all scanned directories under a virtual root folder. Use /GROUPSCANS FALSE if you want to ensure that no virtual root folder is used.
### /HIDESMALLFOLDERS <value> | Allows to hide objects that are smaller than a minimum size, which is useful for getting clear exports. <value> can be a size value with unit, or a plain byte value without unit. Cannot be used in combination wih /EXPAND. In this example only folders having a minimum size of 50MB will be exported: TreeSize /HIDESMALLFOLDERS 50MB /EXCEL "C:\Results\DriveC.xlsx" /SCAN C:\
### /HISTORYCHART <filename> | Saves the graph on the "History" tab of the scanned directory to a bitmap, GIF, PNG, or JPEG file. The file type depends on the extension of the specified file name. This example creates a JPEG image of the history graph for drive C: Treesize /SCAN "C:\" /HISTORYCHART "C:\Documents\c_history.jpg"
### /HTML <filename> | Saves the collected data to a HTML file which can be viewed with any HTML browser. You can specify which information of the scan will be included in the export via "Home > Options > Export > HTML > Charts and lists to include. You can select which of the additional lists, or charts should be added to the export. They will automatically be embedded into the HTML file that is generated after the scan. The following example will generate an HTML report for the drive C: and save it to "D:\HTML": Treesize /SCAN "C:\" /HTML "D:\HTML\treesize.html" If you want more than one scan to be part of the HTML file, you should add the command line switch /GROUPSCANS. When exporting to HTML without an included image, you could alternatively us the switch /APPENDTOFILES.Without one of these flags, the HTML file will get overwritten.
### /IMPORT <filename> | This option can only be used in combination with the command line option /SEARCH. Loads a list of paths into the user interface of the TreeSize file search. The file can be in .txt, or .csv format. This parameter can be used to import results of a previous search. The imported files and folders can be moved/copied/deleted/archived, like any "live" search result, using the file operation dialog. Example: Treesize /SEARCH /IMPORT "C:\Results\filelist.txt" You can also combine this parameter with the parameters /RECYCLE, /DELETE, or /MOVE to automatically delete or move the files that are contained in the text file. Example: Treesize /SEARCH /IMPORT "C:\Results\filesToDelete.csv" /RECYCLE
### /IMPORTPATTERNS <filename> | Imports a list of patterns from a file. The file can be a simple text file with a ist of filter patterns, separated by semicolon, or you can use the user interface to create a more complex set of patterns and use the export function to generate the pattern file in the XML format. Supported formats are CSV, TXT, and XML. The imported patterns will be used as filters for the scan to either include, or exclude specific files and folders. If used in combination with the command line option /SEARCH, this parameter will create a new advanced search that uses the patterns from the imported file as criteria for the search. This example will import filter patterns that are defined under "C:\TreeSizeFiles\patterns.txt", start a scan for drive C:\ and export the results to an HTML file: Treesize /IMPORTPATTERNS "C:\TreeSizeFiles\patterns.txt" /SCAN "C:\" /HTML "C:\Results\scanC.html"
### /INDEXFILE <filename> | Saves the scan results to a SQLite file that can be loaded for comparisons at a later date. Example: Treesize /SCAN "H:\users\" /INDEXFILE "C:\Results\Allusers.sqlite"
### /LISTSEPARATOR <separator char> | Enables you to define the separator used when exporting text or CSV files. Text files use the tabulator by default, CSV-files the list separator from the regional settings of the Windows control panel. Please specify a single character or the string "TAB" for tabulator after this switch. Examples: Treesize /SCAN "C:\" /LISTSEPARATOR ; /TEXT "C:\Results\c.txt" Treesize /SCAN "C:\" /LISTSEPARATOR TAB /TEXT "C:\Results\c.csv"
### /MOVE <path> | This option can only be used in combination with the command line option /SEARCH. It moves the results of a TreeSize file search to another location. The following command will search on your local drive C: using the latest search options and moves the search results to the folder "C:\Temp\ObsoleteFiles": Treesize /SCAN "C:\" /SEARCH:Start /MOVE "C:\Temp\ObsoleteFiles" See also: File operations
### /NOGUI | No window will be shown and the application will not appear in the task bar. Useful to execute scans or searches in background, without visual feedback. Caution: Use this switch only if you have tested the rest of the command line options because error messages cannot be displayed in this mode. However, errors will be logged in the Windows event log.
### /NOHEADERS | Omits the header lines usually written on top of scan or search export files. This makes it easier to receive plain data for postprocessing.
### /NOUNITS | Omits the units usually written after size values. This option in combination with /SIZEUNIT 0 will export plain byte values. This makes it easier to receive plain data for postprocessing. Please note: This command line will only effect exports of the directory tree, generated by using the /TEXT, /EXCEL, /HTML, /EMAIL, or /PRINT options. /EXTENSIONSLIST, /USERSLIST, /EXPORTDRIVESLIST, or /TOPFILESLIST will not be effected.
### /OPEN <filename> | Opens a saved XML report on application start. Example: Treesize /OPEN "C:\Reports\Drive_C.xml.zip"
### /OPTIONS <filename> | Use this parameter to apply exported user settings to TreeSize. User settings can be exported at "File > Options > Export". Example: Treesize /OPTIONS "C:\Temp\User Settings.xml" Hint: Change as many settings a possible in the user interface before saving the options to reduce the amount of command line parameters you need.
### /PDF | Saves the results to a PDF file after the scan or search is finished. The application will terminate itself after saving. The following example will execute a scan of your local drive C: and save the results to a PDF file: Treesize /SCAN "C:\" /PDF "C:\Results\C_scan.pdf"
### /PIECHART <filename> | Saves the pie chart of the scanned directory to a bitmap, GIF, PNG, or JPEG file. The file type depends on the extension of the specified file name. The following example will scan drive C: and export a pie chart in PNG format: Treesize /SCAN "C:\" /PIECHART "C:\Reports\C_pie.png"
### /PRINT | Prints a report for the scanned directory tree using default printer configured in your system settings. The application will be terminated after printing. Example: Treesize /SCAN "\\SERVER\USERS" /PRINT
### /READONLYMODE <value> | If the value is set to true, this option activates a read-only mode in which file operations (e.g. move, or delete) are disabled, so it will be usable as reporting tool only. Start with a value of false to deactivate the read-only mode again.
### /RECYCLE | This option can only be used in combination with the command line option /SEARCH. Moves all files to the recycle bin that have been found as result of a TreeSize file search. Example: Treesize /SEARCH:Start /SCAN "C:\temp" /FILTER "*.tmp" /RECYCLE See also: File operations
### /RESTRICTEDMODE <value> | If the value is set to true, this option activates a restricted mode in which many features are disabled that are not of interest for "normal" (non-admin) users. Among the disabled features are: Check for Update, Open Software applet of Windows Control Panel, Schedule TreeSize scans, connect network drive, configure Windows System Restore, Run as administrator, exports, and apply NTFS compression. You can supply a path that should be scanned, e.g. the user's home directory, at the command line or using the Startup Paths in a saved configuration file. Start with a value of false to deactivate the restricted mode again. If you additionally activate the option /READONLYMODE, the user won't be able to delete or move files in TreeSize, so it will be usable as reporting tool only.
### /SCAN <path|filename> | Defines which drive, or path should be scanned. The scan path should be used as value for this parameter. If, for instance, drive D:\ should be scanned, you can use: Treesize /SCAN "D:\" If you don't want to scan the whole drive, you can also specify a path, which is used as starting point for the scan. For example: TreeSize /SCAN "\\Server\Share\MyDocuments" Multiple scan paths are also possible, they are separated by a blank. Paths containing a blank have to be quoted ("). Example: Treesize /SCAN "C:\Program Files\" "C:\Windows" The wildcards "*" and "?" are allowed. Example: Treesize /SCAN "H:\users\A*" You can also specify a text file, which contains a list of paths that should be scanned. TreeSize will scans all paths that are found in the text file, which is specified after this switch. The text file must contain one path per line. The following example scans all paths that are found in the file "D:\PathsToScan.txt" and writes each scan result to a separate sheet in an Excel File with today's date: Treesize /SCAN "D:\PathsToScan.txt" /EXCEL "D:\Results\%DATE%.xlsx" You may also call TreeSize in a "for" loop with one of the paths only, please find an example below.
### /SEARCH | Opens the File Search window of TreeSize. If ":Start" is added to this command line option, the search is started automatically. A previously saved XML file containing search settings may be passed, these settings will then be used to perform the search. Please note that files which are found in this search are automatically checked. The following example performs the search with settings that have previously been saved to the file "SearchSettings.xml" and saves the results to at text file: Treesize /SEARCH:Start /OPTIONS "SearchSettings.xml" /TEXT "T:\SearchResult.txt" Hint: In general, the last search settings or a former saved set of search settings will be used. However, you can also specify the search patterns for the advanced search using the /FILTER command line option.
### /SHEETNAME <title> | Enables you to specify the name of the sheet that will be added to an Excel file when using the /EXCEL command line switch. Please note that an Excel sheet name must be unique in an Excel file and certain special characters like slashes, backslashes and colons are forbidden. TreeSize will always create a unique sheet name by replacing invalid character with underscores and by adding date and time if necessary. If a sheet with the specified name already exists in the target file, a new sheet with a unique name is created. Use the command line option /APPENDTOFILES to append the data to the existing sheet.
### /SHORTDATEFORMAT <format> | Alters the short date format for this process, which can be configured in the regional options of the Windows Control Panel. Exports of TreeSize will use this format for date values. Example: Treesize /SCAN "E:\" /SHORTDATEFORMAT YYYY-MM-DD /TEXT "D:\export.txt"
### /SIZEUNIT <n> | This option can be used to specify the unit to be used for displaying size values: N can have the values 0 to 5 which mean: 0 = Bytes, 1 = KB, 2 = MB, 3 = GB, 4 = TB, 5 = Automatic Units. Without this option the last used configuration in TreeSize will be used.
### /SORTBY <ColumnName> | Enables you to specify by which value the generated exports will be sorted. Possible values are column names like "Size" or "Name". The last used sort type in the TreeSize user interface will be used by default. Example: Treesize /SCAN "E:\" /SORTBY Size /TEXT "D:\export.txt" Treesize /SCAN "E:\" /SORTBY Name /EXCEL "D:\export.xlsx"
### /SQLITE <filename> | Saves the scan results to a SQLite file that can be loaded for comparisons at a later date. Example: Treesize /SCAN "H:\users\" /SQLITE "C:\Results\Allusers.sqlite"
### /SUBJECT <subject> | This option allows you to customize the subject that will be used for emails that are sent at the end of the scan. Example: Treesize /SCAN "\\Server\Share" /EMAIL treesize@example.com /SUBJECT "TreeSize Professional Scan Report"
### /TEXT <filename> | Saves the results to a text or CSV file after the scan or search is finished. The application will terminate itself after saving. The following example will execute a scan of your local drive C: and save the results to a text file: Treesize /SCAN "C:\" /TEXT "C:\Results\C_scan.txt" The text format uses a tabular format targeting human readers. If the filename references a CSV file, the CSV format will be used instead automatically. If you want to use the CSV format explicitly, we recommend to use the /CSV parameter.
### /TITLE <title> | Can be used to replace the root path of a scan with a custom text. This allows to provide more meaningful names for UNC paths for example and thereby increase the readability of a report. The chosen title will be applied as the title of the report when exporting a file. Example: Treesize /SCAN "\\Server3\C$" /TITLE "C: on Data server 3" /EXCEL "C:\result.xlsx" In the context of a TreeSize file search, this parameter can be used to name an advanced search. Example: Treesize /SEARCH:Start /SCAN "C:\" /TITLE "Image files" /FILTER "*.jpg;*.png;*.bmp" /PDF "C:\Results\C_search.pdf"
### /TOPFILESLIST <filename> | This option enables you to save the contents of the Top files list to an Excel, HTML, Text, or CSV file. The file type depends on the extension of the specified file name. Example: Treesize /SCAN "C:\" /TOPFILESLIST "C:\Temp\C_top_files.txt"
### /TREEMAP <filename> | Saves the treemap chart of the scanned directory tree as bitmap, GIF, PNG or JPEG file. The file type depends on the extension of the specified file name. Example: Treesize /SCAN "C:\" /TREEMAP "C:\Dokumente\treemap.jpg"
### /UILevel <Simple/Normal/Expert> | Sets the level of the user interface. Possible values are Simple, Normal, or Expert. Example: Treesize /UILevel "Simple"
### /USERSLIST <filename> | This option enables you to save the statistics showing the results grouped by username to an Excel, HTML, Text, or CSV file. The file type depends on the extension of the specified file name. The exported columns will be those that were enabled in the user interface on the tab "Users" when it was last used, or at the time when the configuration file supplied via /OPTIONS was written. The following example scans drive C: and creates an Excel file in "C:\Temp" with the statistics of the users on this drive: Treesize /SCAN "C:\" /USERSLIST "C:\temp\C_users.xls"
### /USERNAME <username> | Specifies the username that should be used to authenticate for the scans. Use /PASSWORD to specify a password for this username. It is recommended to instead use the Microsoft tool RUNAS.
### /USERFILTER <username> | With this option only files owned by a certain user will be taken into account when scanning. Provide the name of this user after this switch. Please note that you cannot use multiple user names here, but the wildcards "*" and "?" are supported. Example: Treesize /SCAN "\\Server\GroupDrive" /USERFILTER miller
### /USERSCHART <filename> | Saves the small graph shown on the bottom of the "Users" page to an image file (bitmap, GIF, PNG, or JPEG).
### /USERSPIECHART <filename> | Saves a pie chart that shows the "user statistics" of the current scan to an image file (bitmap, GIF, PNG, or JPEG).
### /VIEWTYPE n | Defines on which values the "Percent of Parent", the "Growth" columns and the "Age of Files" chart are based. Possible value are: 2: Size 3: Allocated Space (Size on disk) 7: Number of Files
### /XML <filename> | Saves the scan results to a XML file that can be loaded for comparisons at a later date. Example: Treesize /SCAN "H:\users\" /XML "C:\Results\Allusers.xml.zip" This option can be combined with the /EXPAND switch to limit the exported directories. Please note: When loading a limited XML export to TreeSize, you cannot navigate though the complete directory branch, but only the exported directories.
### /ZIP <filename> | This option can only be used in combination with the command line option /SEARCH. All files that have been found as result of a TreeSize file search will be moved into a zip archive. Example: Treesize /SEARCH:Start /SCAN "C:\" /ZIP "C:\OldFiles\Archive.zip" See also: File operations
### <SCANPATH> | In addition to the parameter /SCAN, you may also pass one or more paths at the end of the command line. This is no longer recommended though to avoid errors when parsing the command line. This example scans the "Program Files", and the "Windows" folder, and creates a text report under "C:\Reports\ScanResults.txt": Treesize /TEXT "C:\Reports\ScanResults.txt" "C:\Program Files" "C:\Windows"

In case an error occurs, it will be returned as Windows error code in the exit code of the process. Environment variables (e.g. %APPDATA%) can be used In file names for the export as well as in the scanned paths.

## Scanning Multiple Directories

If you need to scan multiple directories, it might be a good idea to merge several calls in a Batch file, for example:

START /WAIT "TreeSize" "C:\Program Files\JAM Software\TreeSize\Treesize.exe" /SCAN "\\Server\Share1" /EXCEL "D:\Share1.xls"

START /WAIT "TreeSize" "C:\Program Files\JAM Software\TreeSize\Treesize.exe" /SCAN "\\Server\Share2" /EXCEL "D:\Share2.xls"

START /WAIT "TreeSize" "C:\Program Files\JAM Software\TreeSize\Treesize.exe" /SCAN "\\Server\Share3" /EXCEL "D:\Share3.xls"

The command "START /WAIT" ensures that the jobs start sequentially. Not starting the jobs parallel is usually better because a single job takes more advantage from caches and system resources. It is also possible to store the shares that should be scanned in a text file and use the Windows "for" command like this:

FOR /F %%p IN (Paths.txt) DO START /WAIT Treesize.exe /SCAN "%%p" /EXCEL "c:\temp\TreeSize-Reports-%DATE%.xls"

FOR /F "tokens=1" %%i IN (Shares.txt) DO START /WAIT Treesize.exe /SCAN "\\Server\%%i" /EXCEL "c:\temp\%%i.xls"

Please note: The double percent characters are required in batch files, on the command line use a single percent only.

## Scheduled Start

You can use the Windows Scheduled Tasks to run TreeSize with certain command line options daily, weekly, or monthly at a certain time. The "Schedule Dialog" of TreeSize will help you setting up a scheduled task.

You can also use the "SCHTASKS" command to perform scheduled scans. If you, for example, want to scan the drives C: and E: next night at 03:00 a.m. and save the results to an Excel file, you could use the following command line:

SCHTASKS /Create /SC DAILY /ST 03:00 /TN TreeSizeScan /TR "'C:\Program Files\JAM Software\TreeSize\Treesize.exe' /SCAN C:\ E:\ /EXCEL C:\Temp\tsp.xls /EXPAND 2"

Get help about the "SCHTASKS" command on Microsoft's pages or by typing:

SCHTAKS /Create /?

Please note: Error messages occurring during scheduled scans are listed in the systems Windows event log.

## PowerShell

Windows PowerShell can be useful in combination with TreeSize. This example shows how to search a couple of remote computers that are queried using an LDAP query in the Active Directory (AD):

$computer = Get-ADComputer -SearchBase "ou=client computers,ou=intranet,dc=intranet,dc=jam-software,dc=com" -Filter *
foreach ($comp in $computer.name)
{
$path = "\\$comp\C$\Windows"
Add-Content Scan.txt "$path"
}
#debug
Get-Content -Path Scan.txt
# start TreeSize with the collected paths
&"C:\Program Files\JAM Software\TreeSize\Treesize.exe" /SEARCH:Start /SCAN Scan.txt /FILTER *.exe /Export FoundFiles.txt

## Redirecting Output

If no other export target is given, TreeSize will write a short export of the scan to the standard output, and errors that occurred during the scan to the standard error.

You can redirect these output streams on the command line (cmd.exe) using the pipe symbol, e.g.

"C:\Program Files\JAM Software\TreeSize\Treesize.exe" /NOGUI /SCAN C:\ 1>StdOut.txt 2>StdError.txt

To redirect the output using the PowerShell, please use the Start-Process command instead, e.g.

Start-Process -FilePath "C:\Program Files\JAM Software\TreeSize\Treesize.exe" -ArgumentList "/NOGUI /SCAN C:\" -RedirectStandardOutput ".\StdOut.txt" -RedirectStandardError ".\StdError.txt"

## Windows Scripting Host

If you intend to use the Windows Scripting Host (WSH), your command to start TreeSize will look like:

Set Shell = CreateObject("WScript.Shell")
Shell.Run """C:\Program Files\TreeSize\Treesize.exe"" /XML ""C:\Reports\drive_c.xml.zip"" /SCAN ""C:\"""

## Exit Codes

If the operation was completed successfully, the exit code is 0. If an error occurred TreeSize will return a Windows error code as exit code if available, or 1 to indicate a general error. In any case the Windows Event Log will contain further information in the "Application" log, Event Source "TreeSize".