-1

I have a question which is very important to me. I've searched with Google, but found nothing. The question is:

How can WinRAR execute a game or software, etc. by just clicking on the .exe file without extracting the files of the software or game?

Can someone please explain that for me with code for Java?

I want to make a software similar to WinRAR, but I don't understand that point.

Mofi
  • 46,139
  • 17
  • 80
  • 143
mogogogo
  • 107
  • 7

2 Answers2

1

Open in WinRAR the menu Options, click on menu item Settings, select tab Viewer and look on option Unpack everything for.

Press now button Help and read explanation for option Unpack everything for.

As you can read, WinRAR extracts all files of the archive on double clicking on a *.exe inside the archive to a temporary folder created in folder for temporary files - environment variable TEMP - respectively the folder defined on tab Paths for Folder for temporary files in the Settings dialog.

Then WinRAR starts the EXE in the temporary folder and monitors the process. After the started application has terminated, WinRAR deletes the temporary folder with all files and subfolders.

Of course in case of exiting WinRAR before exiting the started application, WinRAR let all extracted files in temporary folder forever and the user has to delete them for example with the Windows Disk Cleanup tool.

Same steps are done for example also by Microsoft Outlook for a single file if a double click is made on a file attached to an email. The file is extracted temporarily from the email to a folder for temporary extracted email attachments and deleted automatically by Outlook if the application started to open and display the file has exited. But again the temporary extracted file attachment is kept in the folder and must be deleted later by the user if Outlook itself is exited before the application used to view the temporary extracted file has exited.

In other words, also WinRAR cannot run an application directly from within an archive without extracting first all files of the archive to somewhere on hard disk.

Mofi
  • 46,139
  • 17
  • 80
  • 143
0

Realize that not only do self-extracting zip start extracting with doubleclick, but they require no extraction application to be installed on the users computer because the extractor code is in the archive itself. This means that you will get a different user experience depending on what you application you use to create the sfx e

This is how I used WinRAR to create an sfx of my Izpack Installer which I use to install my Java application

  • Select files, right click and select Add to Archive
  • Use Browse.. to create the archive in the folder above
  • Change Archive Format to Zip
  • Enable Create Archive Format
  • Select Advanced tab
  • Select SFX Options
  • Select Setup tab
  • Enter setup.exe into the Run after Extraction field
  • Select Modes tab
  • Enable Unpack to temporary folder
  • Select text and Icon tab
  • Enter a more appropriate title for your task
  • Select OK
  • Select OK

The resultant exe unzips to a temporary folder and then starts the installer

Paul Taylor
  • 13,411
  • 42
  • 184
  • 351