# How does studio.system.start work?

**URL:** <https://qa.fmod.com/t/how-does-studio-system-start-work/20017>\
**Category:** FMOD Studio\
**Tags:** javascript\
**Created:** [March 24, 2023, 5:58am UTC](https://qa.fmod.com/t/how-does-studio-system-start-work/20017 "2023-03-24T05:58:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skylar1992](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/skylar1992/32/3456_2.png) [@skylar1992](https://qa.fmod.com/u/skylar1992)\
**Post date:** [March 24, 2023, 5:58am UTC](https://qa.fmod.com/t/how-does-studio-system-start-work/20017/1 "2023-03-24T05:58:26Z")

</div>

I want to run a .exe through a custom command and pass in some args. When trying:

`studio.system.start("absolute path to the .exe", {timeout: 1000})`  
It throws:  
Process failed to start: The system cannot find the file specified. (ErrorCode: 0)

`studio.system.start({workingDir: "absolute or relative path to the .exe"}, {timeout: 1000})`  
same thing

`studio.system.start("relative path to the .exe from working dir", {timeout: 1000, workingDir: "c:"})`

same thing

`studio.system.start("C:/Windows/System32/cmd.exe", {})`  
 → Process operation time out (ErrorCode: 2)

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [March 27, 2023, 5:06am UTC](https://qa.fmod.com/t/how-does-studio-system-start-work/20017/2 "2023-03-27T05:06:11Z")

</div>

Hi,

For your first example, it’s likely that something about your path is causing it to fail. Unfortunately, without seeing the path, I can’t comment on what that is. For example, the following works fine for me:

```auto
studio.system.start("C:/Users/MyUsername/AppData/Local/Programs/Microsoft VS Code/Code.exe", {timeout: 1000})

```

For your second and third examples, `workingDir` is the directory that the new process/executable will be opened in, not the path from which your `pathToExecutable` argument operates from. In your second example, you haven’t provided a path to your executable (and `timeout` should be in `{}`). In your third example, if your relative path is from the FMOD Studio executable, and not `workingdir`, it should be fine - my FMOD Studio install directory is:

```auto
"C:/Program Files/FMOD SoundSystem/FMOD Studio 2.0x.xx"

```

so the following command that uses a relative path works:

```auto
studio.system.start("../../../Users/MyUsername/AppData/Local/Programs/Microsoft VS Code/Code.exe", {timeout: 1000, workingDir: "C:/"})

```

If the above hasn’t cleared up your confusion, and/or your paths still don’t work, could I get you to provide your FMOD Studio version?

As for directly running `cmd`, I have been able to reproduce an issue with it not opening a window, and hanging for a long time when attempting to do so, and I’ve noted this in our internal issue tracker. However, If you specify “/c” in your `args`, cmd will still execute commands and then terminate. For example, you can indirectly open a `cmd` window with `studio.system.start("cmd", {args: "/c start cmd"})`, and the following should write “blahblahblah” to “textFile.txt” in your local user folder (i.e. “C:/Users/YourUsername”):

```auto
studio.system.start("cmd.exe", {args: "/c echo blahblahblah >> %UserProfile%/testFile.txt"})

```

Bit of an info dump, but I hope it helps.

---

<div class="post-metadata">

**Author:** ![skylar1992](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/skylar1992/32/3456_2.png) [@skylar1992](https://qa.fmod.com/u/skylar1992)\
**Post date:** [March 27, 2023, 10:37pm UTC](https://qa.fmod.com/t/how-does-studio-system-start-work/20017/3 "2023-03-27T22:37:40Z")

</div>

> [@Leah\_FMOD](#):
>
> `studio.system.start("cmd.exe", {args: "/c echo blahblahblah >> %UserProfile%/testFile.txt"})`

Hi @Leah_FMOD , thanks for the info! Turned out it was a permission issue, after I change the batch script’s output path everything starts working. (Also the cmd workaround is great to know, thx!) I do want to submit a bug on a not related script API call in case other people run into it as well (or maybe it just happens to me locally).

I was trying to make a shortcut for reloading Studio API scripts, doing the following call either from the script or directly typing into the console crashes the Studio Editor.  
`studio.window.triggerAction(studio.window.actions.ScriptReload)`

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [March 27, 2023, 11:30pm UTC](https://qa.fmod.com/t/how-does-studio-system-start-work/20017/4 "2023-03-27T23:30:08Z")

</div>

> [@skylar1992](#):
>
> Hi @Leah_FMOD , thanks for the info! Turned out it was a permission issue, after I change the batch script’s output path everything starts working. (Also the cmd workaround is great to know, thx!)

No problem, it’s good to hear you’ve resolved the issue.

> [@skylar1992](#):
>
> I was trying to make a shortcut for reloading Studio API scripts, doing the following call either from the script or directly typing into the console crashes the Studio Editor.  
> `studio.window.triggerAction(studio.window.actions.ScriptReload)`

That’s a known bug, and `studio.window.actions.ScriptReload` has been disabled as of 2.02.13 as a result. Unfortunately there’s no workaround that I can find to directly reload scripts via the Studio Scripting API. However, if you’re just trying to set a keyboard shortcut, you can do so in Edit → Preferences → Shortcuts → Scripts: Reload.
