Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7734535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:16:27+00:00 2026-06-01T07:16:27+00:00

I just installed node.js for windows and it really was a breeze to get

  • 0

I just installed node.js for windows and it really was a breeze to get it running. I would like to use it as part of my build process to combine several files together like so:

// settings
var FILE_ENCODING = 'utf-8',
    EOL = '\n',
    DIST_FILE_PATH = 'dist/myAwesomeScript.js';

// setup
var _fs = require('fs');

function concat(fileList, distPath) {
    var out = fileList.map(function(filePath){
            return _fs.readFileSync(filePath, FILE_ENCODING);
        });
    _fs.writeFileSync(distPath, out.join(EOL), FILE_ENCODING);
    console.log(' '+ distPath +' built.');
}

concat([
    'foo/bar.js',
    'foo/lorem.js',
    'foo/maecennas.js'
], DIST_FILE_PATH);

This really works like a charm. However it does only work if I place all my scripts into the nodejs directory which is C:\Program Files (x86)\nodejs and start the cmd process with admin rights.

But I need to have my project files in another directory ( say D:\git\projectx\ ) and would like to be able to run: node.exe D:\git\projectx\combine.js. Unfortunatly things doesn’t work that way because node.exe will look for the files within it’s own directory which is C:\Program Files (x86)\nodejs. There must be away to start the nodejs process and tell it to use another directory as its working directory, am I wrong?

UPDATE

As someone pointed out on IRC. The solution to my problem was rather simple. Just cd into D:\git\projectx and then use node.exe combine.js. This makes it so that the current directory inside your script points to D:\git\projectx

However, I’m accepting Luke’s answer since it seems to be also true 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:16:28+00:00Added an answer on June 1, 2026 at 7:16 am

    You can set the current working directory using process.chdir, using Unix-style pathnames:

    process.chdir('/temp/foo');
    

    I’m not sure how to specify the drive prefix (D:) though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just installed my node.js app in a windows micro instance with security group
I'm running node.js on OSX and have just installed mongodb using command npm install
I have just installed MongoDB in my machine (Windows 7) and installed node-mongodb-native using
I've just started with node.js and socket.io. I installed node.js using the windows installer,
This is really weird problem. I just installed Node.JS on my system (Fedora). I
I'm a Mac newbie and just upgraded to Node.js 0.67. After running node, the
I've installed node-qunit (stable) from npm, but can't seem to get any tests working.
I'm doing some R&D on Node.js and so far I like it, I'm just
I've been working with node.js v0.6.3 , locally installed on Windows Vista at C:\Program
I've just installed Node.js off the main branch and when doing the one line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.