Last Updated on July 29, 2017
Do you want to extract some CAB files in Windows with PowerShell? Well, here’s your solution.
Extract CAB Files in PowerShell in the Same Folder
- Press Windows + R to open the Run box. Type Powershell and press Enter.
- Go to the directory where your CAB files are present. For that, you can use the
Set-Location
command. For e.g., if you want to switch from the default%userprofile%
folder to theD:\MyFiles
folder, you can type the following:Set-Location -Path D:\MyFiles
Note: If you want to extract the CAB files somewhere in the C:\
drive, you’ll need to run the PowerShell as an administrator to make it work. For that, simply look for it in the Start menu search and right-click > Run as Administrator. After that, follow the usual process.
- Once you are in the folder with your CAB files, you can use the
expand.exe
program to extract your CAB files.cmd.exe /c "C:\Windows\System32\expand.exe -F: <filename.cab>
Note: Don’t actually put ‘<‘ and ‘>’ in the command because that will cause an error to show up.
Extract CAB Files in PowerShell in a Different Folder
Now, if you don’t want to extract the files in the same folder as the CAB files, you can modify the command to put to the folder location of your choice.
cmd.exe /c "C:\Windows\System32\expand.exe -F: <filename.cab> <full folder location>
You will need to enter the full location of the folder you want to extract your CAB files in. For e.g., you’ll write C:\tempFiles
in the place of the full folder location. Again, remember to not use the ‘<‘ and ‘>’ signs in the actual commands.
That answer is incorrect. You should test things before you post to make sure it is accurate.
The -F switch is not the name of the cab file; it refers to the files that you want to extract, and wildcards are acceptable. The destination can consist of a drive letter and colon, a directory name, a file name, or a combination of these; it does not have to be the full folder location.
Here is what the command should be:
cmd.exe /c “C:\Windows\System32\expand.exe f:*.*