Cliff
Cliff

Reputation: 11248

How is running an .exe from cmd different than double clicking it?

I have a .exe file on Windows (Electron app) That hangs when I launch it via double click but runs fine if I launch it from the cmd prompt or a .bat file. What all can be different?

Again this is an Electron based app from a project I am currently working on.

Upvotes: 4

Views: 2011

Answers (2)

Jossi
Jossi

Reputation: 1080

I got EXCEPTION_ACCESS_VIOLATION from double clicking a program I made, but it runs ok from cmd. If i right click and run as administrator it works also.

I have no idea what makes a program require administration right, sometime it does, sometime it doesn't. From my experience it depends on the code or the compiler, but I cant give more details than that.

Upvotes: 0

Cliff
Cliff

Reputation: 11248

I figured out (with the help of a rather clever co-worker) what the difference is. In my Electron app we have some console.log calls happening in a forked process. When run from the .exe these calls are attempting to write to stdout which is unavailable. Adding a redirect in the code to re-route the output to the file system fixes the problem.

Upvotes: 4

Related Questions