CSCcmd - CMD


Overview

CSCcmd is a client-side caching command-line tool used primarily on Windows operating systems for managing the Offline Files feature. The command provides various administrative functions allowing users to manipulate the offline file cache, such as viewing cache content, pinning new files, synchronizing files, and clearing the cache. This tool is especially useful in network environments where users need to manage files across remote and local storage effectively.

Syntax

CSCcmd [/ENABLE | /DISABLE | /ENUM[:n] | /MOVESHARE:src dst | /PIN:<path> [/RECURSE] | /UNPIN:<path> [/RECURSE] | /FILL | /MARKASGHOST:<path> | /UNMARKASGHOST:<path> | /SFPIN:<path> | /QUERYSPACE | /DELETE:<path> | /DB | /RESID]

Parameters:

  • path: Specifies the path to the target files or directories.
  • src: Source path of the share.
  • dst: Destination path for the share.

Options/Flags

  • /ENABLE: Enables Offline Files feature.
  • /DISABLE: Disables Offline Files feature.
  • /ENUM[:n]: Enumerates the top n files in the offline cache.
  • /MOVESHARE:src dst: Moves a share from src path to dst path.
  • /PIN:<path> [/RECURSE]: Adds the specified path to the offline files cache. If /RECURSE is specified, the operation includes all subdirectories.
  • /UNPIN:<path> [/RECURSE]: Removes the specified path from the offline files cache. Recurssive operation is possible with /RECURSE.
  • /FILL: Forces a database fill operation.
  • /MARKASGHOST:<path>: Marks the specified path file as ghosted in the cache.
  • /UNMARKASGHOST:<path>: Unmarks the ghosted file at the specified path.
  • /SFPIN:<path>: Pin shared folders for offline use without interaction.
  • /QUERYSPACE: Queries the cache size and amount of space currently used.
  • /DELETE:<path>: Deletes the specified path from the offline files cache.
  • /DB: Provides database information of Offline Files.
  • /RESID: Resets the CSC database and recreation occurs on next access.

Examples

  1. Enable Offline Files:
    CSCcmd /ENABLE
    
  2. Pin a directory to cache:
    CSCcmd /PIN:C:\Documents /RECURSE
    
  3. Check cache space usage:
    CSCcmd /QUERYSPACE
    
  4. Move a shared network location:
    CSCcmd /MOVESHARE:\\Server1\Docs \\Server2\BackupDocs
    

Common Issues

  • Permission Issues: Users may face permission issues if not run with administrative privileges. Ensure you execute CSCcmd as an administrator.
  • Database Corruption: CSC database may get corrupted. Using /RESID can reset the database but this should be considered as a last resort due to data loss.

Integration

CSCcmd can be integrated with batch scripts or other command-line tools to automate file management tasks. For instance, combining with robocopy for robust file backup that includes offline cache management:

robocopy C:\Source D:\Backup /MIR
CSCcmd /PIN:D:\Backup /RECURSE
  • robocopy: Robust file copy for Windows.
  • net use: Command to connect, remove, and configure connections to shared resources.

For more comprehensive guidance on managing offline files and related configurations, refer to the Official Windows Documentation.