Question

How can I create a file using the command line Winrar my archive

I've used this command but it did not work

WinRAR.exe a -afzip -df e:\test.rar e:\test.csv

It gives me the error:

Error: 'WinRAR' is not recognized as an internal or external command, operable program or batch file

Was it helpful?

Solution

First you need to make sure that you let the command line interpreter know where winrar.exe is. This can be done in either of (at least) three ways. The following examples assume that winrar was installed into c:\Program Files\WinRAR.

Specify the full path to winrar.exe on the commandline:

"c:\Program Files\WinRAR\WinRAR.exe" a -afzip -df e:\test.zip e:\test.csv

or

Navigate to the folder where winrar is installed

c:
cd "\Program Files\WinRAR"
WinRAR.exe a -afzip -df e:\test.zip e:\test.csv

or

Add the path that contains winrar to the PATH environment variable

This is described in some detail here.

Other than that your command line works just fine, but you should name your output file test.zip since you are using the 'zip' format for compression and not 'rar', otherwise there may be problems opening the resulting files in for example WinRAR.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top