0

I was trying to make a batch file that compresses a specific folder (using winrar) to a specific location (not the same as the folder location), password (that I can choose myself) protects it AND does all of that without a cmd screen popping up.

I have very little knowledge of programming and managed to get some things working, but not all at the same time and in the same batch file.

Also to rar that file do I need Winrar to be installed on the computer or can I reffer to the rar.exe (copied from the Program Files Windows folder to a different location)?

1 Answers1

0

AFAIK it's not possible to run a a bat file without a visible CMD window without using any additional tools. Here's a link to a post how to run a hidden console: https://superuser.com/questions/62525/run-a-batch-file-in-a-completely-hidden-way

It is possible to use just the rar.exe but I would use 7zip instead. The performance is way better, it's also portable and you have many options in the command line. So your project would contain the bat file itself, the vb script file and the 7z.exe (or rar.exe). If you want, you can even create a single .exe file out of these three by creating a SFX file: http://www.7zsfx.info/en/

Hope I could help you.

Community
  • 1
  • 1
MichaelS
  • 5,941
  • 6
  • 31
  • 46
  • rar is also portable and has command line options. "Better" is relative. – SomethingDark Nov 14 '14 at 11:26
  • @SomethingDark 7zip IS way better: http://www.tomshardware.com/reviews/winrar-winzip-7-zip-magicrar,3436-13.html Faster, higher compression, open license (!!) and the binary is smaller. If you don't need a perfect GUI (which is not the case - here we need the cmd tool) there is no doubt that 7zip beats rar. – MichaelS Nov 14 '14 at 12:00
  • @MichaelS, "better" is really relative, see answer on [Script to compress contents of a folder once per month into an archive and then delete](http://stackoverflow.com/a/26823176/3074564) or the answer on [How to archive files older than 7 days with creating one archive for all files with same date?](http://stackoverflow.com/a/25083336/3074564) For the second question there is also [How to archive files older than 7 days with 7-ZIP by creating one archive for all files with same date](http://stackoverflow.com/q/25258824/3074564) with no real 7-Zip solution provided up to know. – Mofi Nov 14 '14 at 13:02
  • @Mofi agreed, let's say more performant but less flexible - but I still think it's the best for this task. – MichaelS Nov 14 '14 at 13:26
  • I know you can't make it invisible, but i only want the launch.exe file to show up, so i've hidden all the bat files, but i also want the cmd window to be hidden while it runs (including the rar window). I will try to compile some of the answers you guys commented and will post the result after. Thanks again. – MrMathiaaaaz Nov 14 '14 at 22:30