How do I make MS-DOS batch function not wait till end of command execution?
If I create such command that executes a bat file, I can't run any other commands (including changing current dir, as Go is also a command) till the script execution is finished. How do I workaround this?
What I'm trying to do is this command for BAT files so I can run them silently in the background using ctrl+enter:
@runmode:hide
{file}
Unfortunately it waits for the script to finish.
By the way, I'm also working on a command like @leavedoswindowopen {file}, so it never closes the window automatically but here I have the same issue). I tried with DOpus function (rather than ms-dos) with cmd /c but it doesn't work with @leavedswindowopen.
I can't run any other commands till the script execution is finished.
This doesn't sound right. Opus is multi-threaded, so it might slow down, but it shouldn't lock up or stall, especially when running an external batch file. Can you provide more context?
Shift+Enter opens a path field at the bottom of the lister by default.
If you've changed your Shift+Enter hotkey, what does it run for you?
@leavedoswindowopen affects the command prompt which Opus opens. It doesn't affect any additional command prompts or similar which anything else (including the commands you tell Opus to run) opens.
If you want cmd.exe to run a command and then not exit, you should use the /k argument instead of /c:
C:\>cmd /?
Starts a new instance of the Windows command interpreter
CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
...
Double-clicks are run on a separate thread, but it will wait for the previous one to complete before allowing a new one to be run. This usually isn't something you notice, since most programs detach themselves as soon as they start, but with DOS functions it's different.
You can use @async to explicitly run something without waiting for it, but that isn't needed here.
If you want to run a .bat file and keep the command prompt open afterwards, via a double-click event, I would use this:
Standard Function: (not MS-DOS Batch)
cd {sourcepath}
/system/cmd.exe /k {filepath$}
That also takes care of setting up the current directory, and avoids any issues with a cmd.exe existing in it and hijacking the command.