nils-soderman / vscode-batch-runner

Visual Studio Code extension to run batch files in the terminal
https://marketplace.visualstudio.com/items?itemName=NilsSoderman.batch-runner
MIT License
5 stars 5 forks source link

Running a Take Command Console .BTM #6

Closed JoeC4281 closed 1 year ago

JoeC4281 commented 1 year ago

Hi, I would like to run a Take Command Console .BTM from VSCode.

I have made the following change; "batchrunner.cmdPath": "C:\Program Files\JPSoft\TCC_RT_28\tcc.exe"

Unfortunately, I have to rename my test.btm to test.bat in order for it to execute when I press F5.

When I press F5 to run test.bat (which is test.btm, renamed), the batch file is executed in the terminal below, and runs as it should, using tcc.exe instead of cmd.exe

image

If I press F5 with test.btm being the active document, I receive;

image

What do I have to change in VSCode so that I can run a Take Command Console .BTM from VSCode using your extension?

(Note that I am not an experienced VSCode user, and that I am still learning).

The runtime version of TCC, which I am using for running a .BTM from VSCode, can be obtained from https://jpsoft.com/downloads/v28/tcc-rt.exe

Thankyou for your assistance.

Joe

nils-soderman commented 1 year ago

Hi,

Oh, seems like vscode doesn't recognize .BTM files :( I'll look into adding proper .BTM support for the extension.

In the meantime, a workaround would be to go into your User or Workspace Settings (JSON), And manually tell VSCode to treat .btm files as batch files by adding the following:

"files.associations": {
        "*.btm": "bat"
}

Thank you for reporting this issue!

Cheers, Nils

JoeC4281 commented 1 year ago

Thankyou, that works for me.

Note well that TCC-RT would be free to distribute with your VSCode Extension, so that would (maybe) make things easier for integration into VSCode.

Note that TCC-RT is a 64-bit only application.

You can contact Rex Conn, owner of JPSoft, to confirm this, and let him know of your intentions, if you decide to go this route.

The JPSoft Forum is very active, and any questions you have about TCC-RT could be answered there.

Joe

AnrDaemon commented 1 year ago

That's not quite correct. While TCC may run .bat files to a degree, it not always correctly replicate all CMD bugs/caveats. Blindly replacing %ComSpec% with TCC is not the right way for living a long and prosperous life.

AnrDaemon commented 1 year ago

A more direct approach could be to map extensions to configured terminals. Then it is up to user to configure terminals and sort extensions across them. F.e. I have configured terminals for

  1. Cygwin Bash (User)
  2. Git Bash (User, not working due to a bug in 1.67+)
  3. PowerShell v7 (User, manually installed)
  4. Windows PowerShell (User, stock one, autodetected)
  5. Windows CMD (User, autodetected)
  6. SSH to dev VM (workspace local)
  7. A list of installed PHP versions (User, depending on

Default terminal is different depending on project. Commonly it is Cygwin Bash, but not always. CMD could run %PATHEXT% scripts from associations, but in Win10+ (may be even Win8) it has a frightening bug of premature symlink resolution, which makes linked scripts useless outside their realpath.

nils-soderman commented 1 year ago

Hi,

Thank you both for your valuable thoughts.

After thinking about this for a while, I've come to the conclusion that officially supporting .BTM files would be out of scope for what this extension sets out to do. Hence the 1.0.1 update has removed all indications that this extension would support .BTM files.

Support for .BTM files should probably be handled by another extension that could revolve more around integrating TCC in VS Code (and possible even bundle TCC-RT, as you mentioned).

Cheers, Nils