---
title: "Discussion on \"Subtle difference between __dirname and process.cwd() in node.js\" | Hashnode"
description: "Discussion on \"Subtle difference between __dirname and process.cwd() in node.js\". Getting the current working directory(CWD) is one of the basic and most important features in a product. In Node.js, CWD can be obtained with either __dirname variable or process.cwd(). But the output returned by each command differs based on the fol..."
url: "https://hashnode.com/posts/subtle-difference-between-dirname-and-processcwd-in-nodejs/5f4a64d0b31aec524c8b3dc5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Subtle difference between \_\_dirname and process.cwd() in node.js](https://blog.commitbyte.com/subtle-difference-between-dirname-and-processcwd-in-nodejs?utm_source=hashnode&utm_medium=feed)

Getting the current working directory(CWD) is one of the basic and most important features in a product. In Node.js, CWD can be obtained with either \_\_dirname variable or process.cwd(). But the output returned by each command differs based on the fol...

Aug 29, 2020 · 1 min read · blog.commitbyte.com  
Read the article

-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#programming](https://hashnode.com/tag/programming)
-   [#bugs-and-errors](https://hashnode.com/tag/bugs-and-errors)

## Written by

[Santhosh Manikandan Soundararajan](https://hashnode.com/@santhoshmanikandan)

@santhoshmanikandan · Chennai, India

  
[View profile](https://hashnode.com/@santhoshmanikandan)

Java/Shell Script developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
