📜  node js查找目录更改目录 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:22.104000             🧑  作者: Mango

代码示例1
// get current directory 
var cur_dir = process.cwd();
console.log(cur_dir);
// change current directory

process.chdir('C:\\Projects\\experiments');
console.log(process.cwd()); 

// path.join for cross-platform paths:
const path = require('path');
process.chdir(path.join('C:', 'Projects', 'experiments'));
console.log(process.cwd()); 
process.exit();