Class: CommandLine
Process:
This class is not exported from the 'electron'
module. It is only available as a return value of other methods in the Electron API.
The following example shows how to check if the --disable-gpu
flag is set.
For more information on what kinds of flags and switches you can use, check out the Command Line Switches document.
commandLine.appendSwitch(switch[, value])
value
string (optional) - A value for the given switch
Note: This will not affect process.argv
. The intended usage of this function is to control Chromium’s behavior.
commandLine.appendArgument(value)
value
string - The argument to append to the command line
Append an argument to Chromium’s command line. The argument will be quoted correctly. Switches will precede arguments regardless of appending order.
If you’re appending an argument like --switch=value
, consider using appendSwitch('switch', 'value')
instead.
switch
string - A command-line switch
Returns boolean
- Whether the command-line switch is present.
commandLine.getSwitchValue(switch)
Returns string
- The command-line switch value.
Note: When the switch is not present or has no value, it returns empty string.
commandLine.removeSwitch(switch)
switch
string - A command-line switch
Note: This will not affect process.argv
. The intended usage of this function is to control Chromium’s behavior.