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

Errors running batch files #17

Open Emblin13 opened 3 months ago

Emblin13 commented 3 months ago

I'm trying to run a simple bat file in my codespace, but can't get it to work for various reasons. When attempting to run a batch file by right clicking and pressing "run", I get the following output in my terminal:

@Emblin13 ➜ /workspaces/Magic-Queries-Main-Repo (main) $ cls & cd "workspaces/Magic-Queries-Main-Repo" & "workspaces/Magic-Queries-Main-Repo/codespace.bat" [1] 17583 bash: cls: command not found [2] 17584 bash: cd: workspaces/Magic-Queries-Main-Repo: No such file or directory bash: workspaces/Magic-Queries-Main-Repo/codespace.bat: No such file or directory [1]- Exit 127 cls [2]+ Exit 1 cd "workspaces/Magic-Queries-Main-Repo"

VSCode also gives me a popup error saying: "Cmd.exe could not be located at C:\windows\System32\cmd.exe". My file does indeed exist in the directory above, so I'm unsure why it's failing to locate the file.

If I try to run the file using F5, I get the same popup error regarding cmd.exe, and the terminal output appears as such:

@Emblin13 ➜ /workspaces/Magic-Queries-Main-Repo (main) $ cls & cd "/workspaces/Magic-Queries-Main-Repo" & "/workspaces/Magic-Queries-Main-Repo codespace.bat" [1] 19373 bash: cls: command not found [2] 19374 [1]- Exit 127 cls bash: /workspaces/Magic-Queries-Main-Repo/codespace.bat: Permission denied

nils-soderman commented 3 months ago

Hi,

Looks like it fails to locate cmd.exe and proceeds to create a default terminal (in your case bash), which fails to execute the .bat file. Going to look into updating the extension to cancel the operation if cmd.exe cannot be located.

You wouldn't happen to run VS Code using WSL? That would explain why cmd.exe cannot be located as it's running in a VM.

Emblin13 commented 3 months ago

GitHub didn't notify me for some reason, sorry about the late response. I'm running VS Code through GitHub Codespace, which I believe uses virtual machines.