---
title: "Comment by DoyinSoft Technologies on \"My Little Automation Script\" | Hashnode"
description: "Interesting, what if I needed it opened at a new path, do I edit the script before every launch?"
url: "https://hashnode.com/posts/my-little-automation-script/5fd5ac10f60e3973bae6bca8/comment/5fd9e328f9e9d5279a16f2b3"
---

[Discussion](https://hashnode.com/posts/my-little-automation-script/5fd5ac10f60e3973bae6bca8)

Comment [My Little Automation Script](https://hashnode.com/posts/my-little-automation-script/5fd5ac10f60e3973bae6bca8)

[DoyinSoft Technologies](https://hashnode.com/@doyinsoft)

[Dec 16, 2020](https://hashnode.com/posts/my-little-automation-script/5fd5ac10f60e3973bae6bca8/comment/5fd9e328f9e9d5279a16f2b3)

# Interesting, what if I needed it opened at a new path, do I edit the script before every launch?

[saud chougle](https://hashnode.com/@chouglesaud)

[Dec 17, 2020](https://hashnode.com/posts/my-little-automation-script/5fd5ac10f60e3973bae6bca8/comment/5fd9e328f9e9d5279a16f2b3#reply-5fdb63801485f22e24b31ed9)

hi, You can set multiple paths. or conditions according to your needs. I would love to see if you make it more interesting.

[DoyinSoft Technologies](https://hashnode.com/@doyinsoft)

[Dec 21, 2020](https://hashnode.com/posts/my-little-automation-script/5fd5ac10f60e3973bae6bca8/comment/5fd9e328f9e9d5279a16f2b3#reply-5fe05f1bb78ac62dff80f0bd)

[chougle saud](https://hashnode.com/@chouglesaud) 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}`);
  });
}
```
