Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a file named windows tutorial.pdf and its size is 140M. I use the rar.exe command from WinRAR to archive it.

rar.exe a -v50m archive.rar "windows tutorial.pdf"

The upper code will create a list of files.


My question is, it there an easy way to specify the archive file name using the original file name (instead of specify it directly in the command like rar.exe a -v50m "windows tutorial.rar" "windows tutorial.pdf")? In this case, what I want is

windows tutorial.part01.rar
windows tutorial.part02.rar
windows tutorial.part03.rar
share|improve this question
up vote 2 down vote accepted

You could write a little batch file to do this for you.

Just create this file with a .cmd or .bat extension:

rar.exe a -v50m "%%~n1.rar" %%1

Then, run it with the file as a parameter:

myrar.cmd "windows tutorial.pdf"

%%1 is the first parameter passed to the batch file. The ~n prefix makes the variable return only the filename, without the extension. For more information on this behavior, see this answer on Stack Overflow.

share|improve this answer
Thanks, this is a good way. – Yousui Jul 2 '11 at 0:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.