When you run a Node.js script, __dirname holds the folder path where the script file is located. This never changes during the script. process.cwd() returns the current working directory where you started Node.js. This can be different from __dirname if you run the script from another folder. For example, if your script is in /home/user/project/scripts but you start Node.js from /home/user/project, __dirname will be /home/user/project/scripts and process.cwd() will be /home/user/project. You can use __dirname to access files relative to your script, and process.cwd() to access files relative to where the user started the program. process.cwd() can also change if you call process.chdir() during the script. This trace shows step-by-step how these values are read and printed.