process.argv0() Method in Node.js


The process.argv0() method is used for storing the read-only copy of the original value for argv[0] that is passed when the node.js application is started.

Syntax

process.argv0()

Parameters

Since it returns only the read-only copy for stored value of argv[0]. It does not need any inputs from the user.

Example

Create a file with name – argv0.js and copy the below code snippet. After creating file, use the following command to run this code as shown in the example below −

node argv0.js

argv0.js

 Live Demo

// Node.js program to demonstrate the use of process.argv0

// Importing the process module
const process = require('process');

// Printing argv0 value for the process
console.log(process.argv0);

Output

C:\home
ode>> node argv0.js node

Example

Let's take a look at one more example.

 Live Demo

// Node.js program to demonstrate the use of process.argv0

// Importing the process module
const process = require('process');

// Printing property value for process.argv0
console.log(process.argv[0]);

Output

C:\home
ode>> node argv0.js /usr/bin/node

Updated on: 20-May-2021

154 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements