Software & Apps > Windows Expand Command Expand command examples, options, switches, and more By Tim Fisher Tim Fisher Facebook Twitter Senior Vice President & Group General Manager, Tech & Sustainability Emporia State University Tim Fisher has more than 30 years' of professional technology experience. He's been writing about tech for more than two decades and serves as the VP and General Manager of Lifewire. lifewire's editorial guidelines Updated on August 20, 2021 Tweet Share Email Tweet Share Email Windows The Ultimate Laptop Buying Guide The expand command is a Command Prompt command used to extract a single file or a group of files from a compressed file. This command is typically used to replace damaged files in the operating system by extracting working copies of files from the original compressed files on the operating system's CD. Expand Command Availability The expand command is available from the Command Prompt in modern versions of Windows, as well as from within the Recovery Console in Windows 2000 and XP. Expand Command Syntax Use the following syntax for the expand command: expand source [destination] [/r] [/i] [/d] [/f [:filespec]] [/y] The availability of certain expand command switches and other command syntax may differ from operating system to operating system. See How to Read Command Syntax if you're not sure how to read the syntax above or in the table below. Expand Command Options Item Description /r Renames expanded files. source Location of the compressed file. For example, this would be the location of a file on the Windows CD. destination The directory where the source file(s) should be copied to. Can consist of a drive letter and colon, a directory name, a file name, or a combination of these. If source consists of multiple files and you don't specify /r, destination must be a directory. /i Renames expanded files but ignores the directory structure. Applies to Windows Server 2008 R2 and Windows 7. /d Lists the files contained in the source but doesn't extract them. /f:filespec The name of the file that you want to extract from the source file. If the source only contains one file, this option isn't necessary. /y Prevents the command from informing you if you are copying over files in this process. Expand Command Examples expand d:\i386\hal.dl_ c:\windows\system32 /y In this example, a compressed version of the hal.dll file (hal.dl_) is extracted (as hal.dll) to the c:\windows\system32 directory. The /y option prevents Windows from asking us if we would like to copy over the existing hal.dll file located in the system32 folder, if there happens to be an existing copy there already. expand /d d:\i386\driver.cab In this example, all the files contained in the compressed file driver.cab are displayed on the screen. No files are actually extracted to the computer. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Email Address Sign up There was an error. Please try again. You're in! Thanks for signing up. There was an error. Please try again. Thank you for signing up! Tell us why! Other Not enough details Hard to understand Submit By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookies Settings Accept All Cookies