Close Cmd/Terminal window after script execution

40 views
Skip to first unread message

bitlischieber

unread,
Feb 10, 2026, 10:47:32 AMFeb 10
to OneCommander
I use a few scripts to automate various tasks, such as opening VS Code and comparing folders with WinMerge.

What’s a little annoying to me is that the command prompt or terminal window stays open after the script finishes.

I’ve tried adding, for example, an exit command at the end of the script, but that didn’t help. I also tried removing the --noexit option from the "PowerShell7Arguments"/"PowerShellArguments" setting, which didn’t make a difference either.

Is there a way to tell the command window to close automatically after the script completes?


bitlischieber

unread,
Feb 26, 2026, 3:32:42 AMFeb 26
to OneCommander

...or another option/feature would be the possibility to define custom commands (toolbar/drop down list?) like it is possible in FreeCommanderXE or similar apps.
Currently I'm misusing the scripts to resemble this functionality.
I regularly start e.g. VsCode oder Fork with the current tab as argument or WinMerge with both open tabs as argument.

OneCommander Support

unread,
Feb 26, 2026, 10:27:20 PMFeb 26
to OneCommander
I'll check on script exit. Asof custom commands... you said "misusing" but then you suggest dropdown list of commands... which is both how it was designed and menu is also kind of a dropdown, so I might be missing something. Buttons will be added to assigne the same scripts, but sometime for v4. 

OneCommander Support

unread,
Feb 26, 2026, 11:01:13 PMFeb 26
to OneCommander
Just to confirm, you say "PowerShell7Arguments"... the scripts get their configuration from ScriptExecutors.json in settings folder, so you need to edit that file (and fully restart program). 
For example, to close window after running .bat script you give /C instead of /K
  {
    "Executable": "cmd.exe",
    "HeaderTags": "#CMD",
    "Extensions": "bat",
    "Arguments": "/C \"SCRIPT_PATH\""
  }

Other settings are for F10 opening a command line window only, so the window has to stay open

bitlischieber

unread,
Mar 5, 2026, 7:30:47 AM (11 days ago) Mar 5
to OneCommander
Thank you very much — the adjustments in ScriptExecutors.json have achieved the desired result.
By “misuse,” I meant that the script could be used to perform much more complex tasks. However, I only need it to start programs within the folder context. Therefore, the console window should close again after launching the application.

By “toolbar/dropdown,” I meant a new feature that allows configuring programs to launch within the folder context, instead of creating a separate script file for each application. I know this functionality from FreeCommanderXE, where you can define buttons to start applications. Sorry for the confusion!

OneCommander Support

unread,
Mar 6, 2026, 11:26:19 PM (9 days ago) Mar 6
to OneCommander
Please explain the second part and anything else that might be useful for those scripts/scriptable buttons. I have not used FreeCommanderXE so I don't know what that feature is, but think of it as a blank slate that anything might be possible so what is all that you think would be useful and how things would work, be configured, or anything else. 
Reply all
Reply to author
Forward
0 new messages