Can't get @echo off to work

My button uses "MS-DOS" to opens a Node.js command window via a .bat file. I want the window to always navigate to a specific folder when clicked: "H:\AI\Environments\InvokeAI\invokeAI\frontend"

There is no problem if I do this manually:

In my code, I tried with and without quotes, but it always opens to the current directory I am in. (e.g., {sourcepath})

Here is my code:

C:\Windows\System32\cmd.exe /k "C:\Program Files\nodejs\nodevars.bat"
@echo off
h:
cd\
cd "H:\AI\Environments\InvokeAI\invokeAI\frontend"

Please tell me how to fix this. Thanks!

So the only problem is that @echo off isn't working, or something else?

Please show us the button you're using, as we're missing details like the mode the button is using (should be MS-DOS Batch Function in this case).

The DOS cd command needs a /D before the path if you want to give it a full path. (Not required by the Opus command, but the DOS one has always been like this.)

You might also want to use @externalonly at the start of the button.

I wrote that the button is using MS-DOS. I was referring to "MS-DOS Batch Function."
I don't mind using the Opus command, whichever one works is fine.

I'm not sure what you didn't understand.
The first line of code works, as the command window opens fine.
What's not working is from @echo off and below.
I need it to navigate to that directory and then execute the code "yarn preview."

Here's the button with the added /D:

Do you need to run nodevars.bat in a separate cmd.exe?

If yes, double the quotes.

1 Like

Actually, I didn't think of that; I just copied the shortcut's path as-is. I just tried running the .bat without

C:\Windows\System32\cmd.exe /k 

and now it works great. Thanks!