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

Strange behavior each line is run separately #7

Closed Kotsuha closed 1 year ago

Kotsuha commented 1 year ago
echo Hello
set foo=bar
echo 1
echo 2
echo 3
echo %bar%

What I see in VSCode terminal

C:\Temp>echo Hello
Hello

C:\Temp>set foo=bar

C:\Temp>echo 1
1

C:\Temp>echo 2
2

C:\Temp>echo 3
3

C:\Temp>echo
ECHO is on.

C:\Temp>

Batch Runner v1.0.0 VSCode 1.72.2

nils-soderman commented 1 year ago

Hi,

Yes, wouldn't that be the expected result? This is the same as running the batch file in cmd/powershell (This extension executes your batch file in cmd.exe by default).

Maybe you wanted to insert @echo off at the top of the batch files, to prevent the commands from being shown? Also, you probably wanted to echo %foo%, not %bar%:

@echo off

echo Hello
set foo=bar
echo 1
echo 2
echo 3
echo %foo%
Hello
1
2
3
bar

C:\Temp>

Cheers, Nils

Kotsuha commented 1 year ago

Oops, it's a silly mistake made by me. Thank you! It's working as expected now.