Wrap a portable app into a single .exe file, or anything clean ?

  • (2 Pages)
  • +
  • 1
  • 2

28 Replies - 821 Views - Last Post: 09 March 2018 - 09:24 AM Rate Topic: -----

#1 ge∅   User is offline

  • D.I.C Lover

Reputation: 192
  • View blog
  • Posts: 1,184
  • Joined: 21-November 13

Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 01:35 PM

Hello there,

I have been tasked with converting a web application into a portable Windws application. The app is intended for complete neophytes.

I am using Electron and electron-packager which exploit Chromium's rendering engine as well as NodeJS to interpret my Javascript, HTML and CSS code and make a desktop app out of my mess. It is so convenient for me.

The problem I have is that the generated .exe file is lost between folders and .dll and .bin and .dat and .pak files. I understand all of this is totally normal but I am afraid it scares the users and I would like to produce something cleaner.

Is there a way to make it more tidy ? It could simply be having the executable be outside of a folder containing everything else, or even better, an archive containing every thing else, or even better, have just one single .exe file (hey, it's perfectly fine to have fantasies)...

I have been looking for solutions online but people on forums usually get confused between a portable app, a self-extracting archive, an installer, etc. and so I get confused as well. And when they start speaking of .NET and such I just don't know if it concerns me or not.

I don't mind paying for a licence as long as it's not insanely expensive. It is something I sell, so I can have the client pay for it, and I would be interested by such software for my personal projects as well.

If you have any idea, do not hesitate to share it!
Thank you

Is This A Good Question/Topic? 0
  • +

Replies To: Wrap a portable app into a single .exe file, or anything clean ?

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14089
  • View blog
  • Posts: 56,441
  • Joined: 12-June 08

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 01:55 PM

Let me get this straight.

You have a web page.. web app... web game.. whatever it may be, and you want to keep the exact same functionality but inside of an .EXE for the windows platform?

Is this website yours? Do you have access to the code?
Was This Post Helpful? 0
  • +
  • -

#3 ge∅   User is offline

  • D.I.C Lover

Reputation: 192
  • View blog
  • Posts: 1,184
  • Joined: 21-November 13

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 02:37 PM

Yes, and I am already mid-way with Electron. https://electronjs.org/

Everything you do in a browser you can bring to the desktop effortlessly with this piece of software. It's not as good as a native app, it embeds a browser engine to run your code basically, it can also run your server-side code if you need to write files to the file system, this kind of thing. It's good enough for small applications and it doesn't require skills outside web-development (key factor for me).

I wrote every piece of code of the web app, client side and server side, there is no issue about it.

The status of this project is that I can build the portable app, it runs, but it is not a single file (or a small number of files), it's messy and it's going to confuse the end user. I want to try and make it more tidy.


The web app use to be a one-page website if you like, running in a browser, online and offline, (with applicationCache). The users were confused by the fact that they were using a software in a browser, and many of them had their browser set to clear the cache every now and then, so they would not benefit from the offline feature and they were not savvy enough to set their browser differently. Basically, they need a desktop app and it should not be a mess of files, they want to download something, double-click on it and see it work.

This post has been edited by ge∅: 05 March 2018 - 02:40 PM

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14089
  • View blog
  • Posts: 56,441
  • Joined: 12-June 08

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 02:44 PM

I gotcha. I never used the product and I wasn't sure if there were better ways to run the web portion to produce better output on the back end. ex - not using wordpress with a bajillion files when a static site would cut it down.. that sort of thing.
Was This Post Helpful? 0
  • +
  • -

#5 ge∅   User is offline

  • D.I.C Lover

Reputation: 192
  • View blog
  • Posts: 1,184
  • Joined: 21-November 13

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 03:08 PM

That's another topic but I doubt you can use Wordpress for this kind of thing because all the tools currently designed to help web devs make desktop and mobile apps rely on V8 (Google's JS engine) for the server-side part, so they will use NodeJS, they will use Angular, they will use React... anything built upon Javascript.

As I think you have guessed, none f the dll, bin, dat files have anything to do with my code. They may be dependencies of the included browser engine or V8, or Electron itself.

That's why I'm posting here. Maybe we can do something simple like simply have a shortcut with a relative path so that I can send users a folder and a shortcut and tell them to simply keep them always together. That's simple enough. Or, if paths are necessarily absolute in windows, maybe it could be an .exe file getting its own absolute path, concatenating it with the relative path to the app's executable located in the companion folder and launching it. Does that make sense ?

It doesn't matter if it's not super professional. The client knows I'm a web dev, and maybe there is no way to make a portable app clean. You have to put your junk somewhere, but it should be straightforward for the user.

This post has been edited by ge∅: 05 March 2018 - 03:12 PM

Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14089
  • View blog
  • Posts: 56,441
  • Joined: 12-June 08

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 03:10 PM

I am not following.. why not just have a short cut to the main executable? Seems that would save anyone from having to look too far into a folder or determine what's going on.
Was This Post Helpful? 1
  • +
  • -

#7 ge∅   User is offline

  • D.I.C Lover

Reputation: 192
  • View blog
  • Posts: 1,184
  • Joined: 21-November 13

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 03:28 PM

I'm not a Windows user this much, can shortcut paths be relative ? Because if they can, and I can set a custom icon (relative path for this as well ?) that would be so much better already.

This post has been edited by ge∅: 05 March 2018 - 03:28 PM

Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14089
  • View blog
  • Posts: 56,441
  • Joined: 12-June 08

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 03:31 PM

It's not an issue of relative path. It's just the path.
Was This Post Helpful? 0
  • +
  • -

#9 ge∅   User is offline

  • D.I.C Lover

Reputation: 192
  • View blog
  • Posts: 1,184
  • Joined: 21-November 13

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 03:38 PM

Not sure what you mean. I will have to test this on a Windows machine. I need the path to still be good if you move the shortcut + folder to a USB stick or any folder on any drive. If the path is fully qualified, like C:\folder\folder\app\myapp.exe, it's not good for portability.
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14089
  • View blog
  • Posts: 56,441
  • Joined: 12-June 08

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 03:43 PM

Wait - why is this app on a thumb drive now? I thought this was being installed on local machines and running because people don't get how to refresh their browsers.
Was This Post Helpful? 0
  • +
  • -

#11 ge∅   User is offline

  • D.I.C Lover

Reputation: 192
  • View blog
  • Posts: 1,184
  • Joined: 21-November 13

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 05 March 2018 - 03:48 PM

OK, I found some info here http://sumtips.com/2...in-windows.html there seem to be two solutions to the problem. It's promising.

Nope, it isn't installed, it has to be a portable app.

I made a webapp initially for a reason: it needs to be run on arbitrary computers, and having the user install something one someone else's computer is not very graceful (or even possible in companies for example). I actually have a MacOS version ready (just in case) which is very clean because everything is packaged in a single .app file, but for Windows it's more complicated.

This post has been edited by ge∅: 05 March 2018 - 03:49 PM

Was This Post Helpful? 0
  • +
  • -

#12 ge∅   User is offline

  • D.I.C Lover

Reputation: 192
  • View blog
  • Posts: 1,184
  • Joined: 21-November 13

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 06 March 2018 - 04:35 AM

It worked like a charm!

The trick was to create a .bat pointing to the executable with a relative path, then convert it with Bat_To_Exe_Converter which also allows to include a custom .ico file. It outputs a .exe file with the right icon and launches my app from any location as long as the folder and the shortcut have the same parent folder. I haven't tried putting it on another Windows machine though. The client will tell me if it works for him as well.

I am still looking for a solution to wrap everything in a container app and have only one file but I am starting to doubt it is even possible.
Was This Post Helpful? 0
  • +
  • -

#13 baavgai   User is online

  • Dreaming Coder
  • member icon


Reputation: 7181
  • View blog
  • Posts: 14,969
  • Joined: 16-October 07

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 06 March 2018 - 04:49 AM

I'll admit, I'm not fully understanding the need to bundle. This thing is NodeJs dependent. Isn't that kind of already a clean collection of stuff, with it's own installer? Your client would need nodejs installed, so installing your app should simply be a matter of npm install -g <package>. Indeed, for easy of distribution, npm offers some packaging tools that will make you a .tar.gz automatically, which you can throw on a local server.

To run the beast, well, your environment will already have the global node_modules in the path to run node. A main declaration in your package.json will, at the very least, offer you a command line application.

I'm now thinking of making a quick proof of concept for this. Hmm... since you know your environment is windows, you could probably roll it up with a script to make a desktop icon.
Was This Post Helpful? 0
  • +
  • -

#14 ge∅   User is offline

  • D.I.C Lover

Reputation: 192
  • View blog
  • Posts: 1,184
  • Joined: 21-November 13

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 06 March 2018 - 08:22 AM

It is not dependent only of NodeJS and I can't ask the client's users, who are not tech savvy at all, to set up a local server. Moreover, this wouldn't be portable and it is a requirement.

It's a niche thing. I honestly thought a web app or progressive web app as they call it would be perfect for the use case - and it was a secure - but it was too abstract for the end user. The client was kind of embarassed when they asked me to make a portable app and I asked them why.

Anyways. The client seems to be having issues with my hack. Their PCs are locked and require administrator rights to run the executable. I'm not sure the end user is concerned by this limitation though.
Was This Post Helpful? 0
  • +
  • -

#15 baavgai   User is online

  • Dreaming Coder
  • member icon


Reputation: 7181
  • View blog
  • Posts: 14,969
  • Joined: 16-October 07

Re: Wrap a portable app into a single .exe file, or anything clean ?

Posted 06 March 2018 - 09:41 AM

View Postge∅, on 06 March 2018 - 10:22 AM, said:

It is not dependent only of NodeJS...


Ok... I don't know why you'd need a server. Obviously, more moving parts than I can see.

Like I said, you'd need to have node installed for Electron to work. For instance, their hello world: https://github.com/e...ron-quick-start .

Now, here's how I'd package that. Peek in package.json and you'll find a start that reads "electron ." That's not over useful, but a little hunting finds that will ultimately do this: node ./node_modules/electron/cli.js ./main.js.

I actually need a single .js that node will launch for me, so I poach that cli.js and make a file called launch.js that looks like:
#!/usr/bin/env node

var electron = require('electron')

var proc = require('child_process')

var child = proc.spawn(electron, ['main.js'], {stdio: 'inherit'})
child.on('close', function (code) {
  process.exit(code)
})



A quick check with node ./launch.js shows all is well. Now we're ready! In that package.json I add the entry:
  "main": "launch.js",
  "bin": {
      "tada": "launch.js"
  },



Do a npm install -g[il]. If all is well and paths are correct, if I type [il]tada on the command line, I get my newly installed app. Alternately, you can just plunk the entire directory somewhere and create a desktop link to run node and launch.js. I see no reason why you couldn't put that on a flash drive and install it on a user's box with a script, if you didn't want to use the default npm functionality.

It really shouldn't matter how much crap is in the application directory, as long as the user need only have a single thing to execute.
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2