It's a simple script that helps to launch VSCode and Terminal at the provided path. I have to just type node project.js const { exec } = require('child_process'); const fullpath = '/desire/path'; main(); function main() { launchVSCodeAt(fullpath...

Markdown supported · ⌘↵ to post
chougle saud So I decided to enhance the codes making it possible to type in the desired path upon execution of the script:
you can find the new script below
const { exec } = require("child_process"); const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); var fp = ""; rl.question("Enter a Valid Path to Open: ", function (p) { fp = p; main(); rl.close(); }); function main() { launchVSCodeAt(fp); launchTerminalAt(fp); } function launchVSCodeAt(path) { exec(`cd ${path} && code .`, (err) => { if (err) console.log(`failed to launch VSCode at ${path}`); console.log(`VSCode launched at ${path}`); }); } function launchTerminalAt(path) { exec(`cd ${path} && start cmd`, (error) => { if (error) console.log(`failed to launch Terminal at ${path}`); console.log(`Terminal launched at ${path}`); }); }