How may I create a package installer and extract the contents only in a specific folder

190 Views Asked by At

Edit: Oops my bad! I wasn't clear enough... I guess I need to explain more...

I need to create a package installer for my customers. I want them to extract and overwrite the contents only in their specific folder.

I don't want them to be able to extract the contents wherever they want to let them steal my work /or know what my files are all about.

So I was thinking maybe the installer could be created in a way to check for a file name inside the folder and after the file name has been recognized then it can be simply extracted and overwritten and if not then the operation will be cancelled.

Any Idea ?

2

There are 2 best solutions below

0
On

Okay, so I believe this might help:

https://superuser.com/questions/259353/7-zip-windows-7-make-extract-to-folder-default-on-double-click

Particularly Haiggoh's comment:

1.Start regedit as administrator 2.Open HKEY_CLASSES_ROOT\7-Zip.7z 3.Under that key, expand the Shell sub-key 4.Set the (Default) value to the string extract 5.Create a new sub-key named extract 6.Set the (Default) value for the extract key to Extract to Folder 7.Create a new sub-key under extract named command 8.Set the (Default) value of the command key to:

C:\ProgramFiles\7-Zip\7zG.exe x "%1" -o* (you might have to a adjust this to match the path of you 7zip installation)

Instead of 7z with -aou like Justin Roettger suggested I ended up using 7zG, because this way you can choose to overwrite if you like just like extracting with the normal context menu.

That's it! 7z files are now extracted to a folder with their own name by double click. For other extensions like .rar and .zip you need to repeat these steps for the according keys. (i.e. HKEY_CLASSES_ROOT\7-Zip.rar and HKEY_CLASSES_ROOT\7-Zip.zip and so on)

Oh and to clarify: It does work with multiple files selected as well. No batch file need.

Have a read through the above and hopefully it'll point you in the right direction.

5
On

Assuming you're running Windows...If the file name is recognised in the specified extraction folder, then it'll prompt you to either overwrite or cancel. - Either using Window's own extractor or something like 7Zip will achieve this.