Coder Social home page Coder Social logo

Comments (5)

jasondavis avatar jasondavis commented on August 11, 2024 8

can these command line args be passes to an electron apps .exe windows version of the app

like:

my-electronjs-app.exe -args

from electron-prebuilt.

watsoncj avatar watsoncj commented on August 11, 2024 6

The renderer process can access the main process argv like so:

require('electron').remote.process.argv

from electron-prebuilt.

mafintosh avatar mafintosh commented on August 11, 2024

You just pass then after your script file

// save as test.js
console.log(process.argv)

and then

npm install -g electron-prebuilt
electron test.js hello world

from electron-prebuilt.

s-a avatar s-a commented on August 11, 2024

Thanks for the quick response.
I have tried this but getting always this result

["C:\Users\Stephan\AppData\Roaming\npm\node_modules\electron-prebuilt\dist\electron.exe", "--type=renderer", "--no-sandbox", "--enable-deferred-image-decoding", "--lang=de", "--node-integration=true", "--device-scale-factor=1", "--font-cache-shared-mem-suffix=2764", "--enable-pinch-virtual-viewport", "--enable-delegated-renderer", "--num-raster-threads=1", "--channel=2764.8.56440853\521306387", "/prefetch:673131151"]

Here is my code

var electron = require('electron-prebuilt')
var proc = require('child_process')

// will something similar to print /Users/maf/.../Electron
console.log(electron)

// spawn electron
var child = proc.spawn(electron, ["./app", "foo=bar"]);

from electron-prebuilt.

s-a avatar s-a commented on August 11, 2024

I just figured out that it works for me if I hold a copy of process.argv in process.env

process.env.XXXargv = JSON.stringify(process.argv)  ;

from electron-prebuilt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.