VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-process-cwd-method/

⇱ Node process.cwd() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node process.cwd() Method

Last Updated : 12 Jul, 2025

The process.cwd() method is an inbuilt application programming interface of the process module which is used to get the current working directory of the node.js process.

Syntax:

process.cwd()

Parameters: This method does not accept any parameters. Return Value: This method returns a string specifying the current working directory of the node.js process.

The process.cwd() method returns the current working directory of the Node.js process.

Example 1: Below examples illustrate the use of process.cwd() method in Node.js:

Output:

Current working directory: C:\nodejs\g\process

Example 2: Below examples illustrate the use of process.cwd() method in Node.js:

Output:

Current working directory: C:\nodejs\g\process
Working directory after changing directory: C:\nodejs\g\os

We have a Cheat Sheet on Node Process Methods where we covered all the process methods to check those please go through Node Process Complete Reference this article.

Comment

Explore