When it comes to compressing and extracting files, WinRar and 7zip are two popular software options. These programs allow you to create smaller file sizes by compressing multiple files and folders into a single archive. In this article, we will explore the command line options to extract an archive in a new folder using WinRar and 7zip.
WinRar Command Line
WinRar is a powerful compression tool that supports a wide range of archive formats. To extract an archive in a new folder using the command line, you need to follow these steps:
- Open the command prompt by pressing the Windows key + R, typing "cmd" and hitting Enter.
- Navigate to the directory where the WinRar executable is located. This is usually
C:\Program Files\WinRAR. - Once you are in the WinRar directory, you can use the following command to extract the archive in a new folder:
rar x [archive_path] [destination_folder]
Let's break down the command:
rar: This is the command to initiate the WinRar program.x: This option specifies that you want to extract the archive.[archive_path]: Replace this with the path to the archive file you want to extract.[destination_folder]: Replace this with the path to the folder where you want to extract the archive. If the folder doesn't exist, WinRar will create it for you.
For example, if you have an archive file called "example.rar" located in the "Downloads" folder and you want to extract it into a new folder called "Extracted", the command would be:
rar x C:\Users\YourUsername\Downloads\example.rar C:\Users\YourUsername\Extracted
After executing the command, WinRar will extract the contents of the archive into the specified folder.
7zip Command Line
7zip is another popular compression tool that is known for its high compression ratio. To extract an archive in a new folder using the command line with 7zip, follow these steps:
- Open the command prompt by pressing the Windows key + R, typing "cmd" and hitting Enter.
- Navigate to the directory where the 7zip executable is located. This is usually
C:\Program Files\7-Zip. - Once you are in the 7zip directory, you can use the following command to extract the archive in a new folder:
7z x [archive_path] -o[destination_folder]
Let's break down the command:
7z: This is the command to initiate the 7zip program.x: This option specifies that you want to extract the archive.[archive_path]: Replace this with the path to the archive file you want to extract.-o[destination_folder]: Replace this with the path to the folder where you want to extract the archive. If the folder doesn't exist, 7zip will create it for you.
For example, if you have an archive file called "example.7z" located in the "Downloads" folder and you want to extract it into a new folder called "Extracted", the command would be:
7z x C:\Users\YourUsername\Downloads\example.7z -oC:\Users\YourUsername\Extracted
After executing the command, 7zip will extract the contents of the archive into the specified folder.
Conclusion
Both WinRar and 7zip provide command line options to extract archives in new folders. By following the steps outlined in this article, you can easily extract your archives using the command prompt. This can be particularly useful when you want to automate the extraction process or perform batch operations.
References
| Software | Website |
|---|---|
| WinRar | https://www.win-rar.com/ |
| 7zip | https://www.7-zip.org/ |