Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 rar that is hidden.I want to add more files with it using winrar (preferably); without make visible is there any way to do it with cmd or batch file?

share|improve this question
I think in MSDOS/Windows-Shell a hidden file is inaccessible. – phoeagon Apr 22 '13 at 10:37
@phoeagon I just created a hidden file and typed it, no problems at all. Back in MS-DOS, MSDOS.SYS and IO.SYS were marked with attributes hidden and system (I do believe read-only as well); imagine the havoc if those couldn't be accessed. – Michael Kjörling Apr 22 '13 at 10:45
up vote 1 down vote accepted

There are actually two parts to your question. First, how to add files to a hidden RAR archive using WinRAR. Second, how to do it from a command line.

Windows itself does not place any restrictions on access to files marked "hidden". They are just that; hidden, not inaccessible.

Back in the old days of MS-DOS, two key system files were marked as hidden: IO.SYS and MSDOS.SYS. These two files make up the MS-DOS kernel and were loaded into RAM by the boot sector code (in early DOS versions, at least one of them -- I forgot which one -- had to exist in a contiguous disk region because otherwise the boot sector code couldn't load it). Imagine the havoc it would create if the OS kernel was inaccessible.

You can try this yourself by doing something like the following:

C:\> echo hello > myfile.txt
C:\> attrib +h myfile.txt
C:\> type myfile.txt
C:\> echo world >> myfile.txt
C:\> type myfile.txt

The attrib +h myfile.txt sets the "hidden" attribute on the file (you could do this through another tool as well, I just stuck to the command line here for simplicity).

Note that WinRAR might barf at being asked to operate on archive files with the hidden attribute set, although frankly I doubt it implements such checks. Notepad has no problem working with files marked as hidden.

The second part is how to drive WinRAR (or any RAR archiver) from the command line. That is something I don't know, and it might actually be better to ask that as a separate question.

share|improve this answer
Thank you mate for the valuable info as for the separate question my purpose is to do it with cmd and with rar so i dont think a separate question will help me since i want them both in the same time – user2237380 Apr 22 '13 at 12:23

WinRAR also comes with the command line utility rar, which you should use for this task.

As explained by Michael Kjörling, there is nothing stopping you from adding files to an archive that has the hidden attribute set. To add a file to an archive, use the following command:

rar a archive.rar filetoadd.ext

a stands for the add command.

share|improve this answer
Hmm i was using the command "C:\Program Files\WinRAR\Rar.exe" a -hp -ep3 -r -e+rash "D:\aaa.rar" C:*.doc D:*.doc E:*.doc but in the beginning i was seeing access denied and i thought it wasnt working after i left it for a bit i saw it was actually working ok .But in the end it makes the rar visible and not hidden.When i add the u(update its not working at all).Why it doesn't stay hidden?And can i make it remain? – user2237380 Apr 22 '13 at 12:44
@user2237380: You probably got the Access Denied error because you were on C:\Program Files where you don't have write access. If you update an archive, RAR will create a new, temporary archive in the current working directory (that's why you got the error). After completing the new archive, it will overwrite the old archive with the new file. That's why the hidden attribute is lost. To my knowledge, there's no way to have RAR respect the existing file system attributes on the archive. – Oliver Salzburg Apr 22 '13 at 12:48
So i have to remake it hidden ?That beats my purpose for the thing i actually i want to do :( .But thank you mate for your time you have been most helpful :) – user2237380 Apr 23 '13 at 9:41

I don't think it's possible to add files to a hidden RAR using WinRAR. You will have to unhide the file for the duration of adding files atleast and then re-hide it again.

share|improve this answer
I thought so as well but still i hoped someone might know a way – user2237380 Apr 22 '13 at 10:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .