Batch Scripting Language

I’m opening this Topic for discuss about Batch Scripting Language,
related topic: Batch Scripting Language

I think this can be closed as a duplicate of Batch Scripting Language

This category was different, It seems required for discuss a new Track.

I was going through @IsaacG 's documentation and I got stuck trying to understand it all at once, I need to go step by step but things got a bit complicated, I think I need to open a new repo since I’m opening a track from scratch, if so, should I open it in my profile or under exercism? Should I copy the templat of a repo and delete all the exercises or can I create a new Track folder structure with exercism CLI?

It would be great if someone can mentor me in this process.

I just linked to the docs. I believe @iHiD wrote most if not all of it.

I recommended opening a thread in the correct category per the documentation. If @iHiD says that’s not needed and he’s fine with reusing the existing thread, then that’s what should happen. Apologies for the confusion.

1 Like

@iHiD I’m very confused about how to get started if it’s ok with you, can we have a session if possible? Maybe Discord or Google Meets.

Based on the +3 TimeZone, I can adjust my availability after 3 pm on weekdays. If you give me a day and time suitable for the +3 TimeZone, I can adjust myself accordingly.

I don’t really have availability for 1-1s, sorry.

To get started we need two things:

  1. To confirm the language is Turing complete.
  2. To see a Hello World example in your language.

Once those are done and agreed, we’ll create you a repo and you can work through it following the docs here: New Track | Exercism's Docs. The docs are pretty comprehensive, and lots of people in the community have used them to create tracks so can give you advice and pointers as necessary.

I understand your busy.

  1. Batch Scripting Language was able to compute and pass the first one.
  2. Hello world in batch is so easy like just “echo hello world!”, you can even test with just open your terminal and type, that’s batch, not has depency.

If a repo is opened for this, I would be happy to proceed accordingly. As you can see, the ecosystem of the language is well established, so beginners will not bother to set up anything.

I think an exercise example typically includes a working test runner for it :slight_smile:

A simple millisecond calculator may seem complicated to you now, as it is a bit difficult to keep time in Batch language.
Let’s take a look at the first exercise, hello world, difficulty level 1.
exclamation has a special meaning in batch language and can actually be used as a string, but I used “Hello world” instead of “Hello world!” because it would seem difficult for input.


  "exercises": {
    "practice": [
        "uuid": "",
        "slug": "hello-world",
        "name": "Hello World",
        "practices": [],
        "prerequisites": [],
        "difficulty": 1

Goal: print ‘Hello world’ on the screen. You can do this by editing the ‘Hello’ text.

Pre-Info: In Batch Scripting Language, to write a text on the screen, we first type the word ‘echo’ and then whatever we type comes up on the screen.

Code.bat [Template]

echo Hello

Code.bat [Expected]

echo Hello world

Test Case (bench.bat)

    bench.bat Code.bat
STDOUT: "Hello world"
Elapsed time: 2 milliseconds
  • Where Code.bat is a parameter.

bench.bat (source code)

@echo off
setlocal enabledelayedexpansion

REM Get the start time in milliseconds
for /F "tokens=1-4 delims=:.," %%a in ("%TIME%") do (
    set /A "start_time=(((%%a*60+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100)-10000"

REM Process to measure task time
set "result="
for /f "delims=" %%a in ('%~1') do set result=%%a

REM Get the end time in milliseconds
for /F "tokens=1-4 delims=:.," %%a in ("%TIME%") do (
    set /A "end_time=(((%%a*60+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100)-10000"

REM Calculate the elapsed time in milliseconds
set /A "elapsed_time=end_time - start_time"

echo STDOUT: "%result%"
echo Elapsed time: %elapsed_time% milliseconds

Yes, you deleted it, but I noticed a problem while I was examining it.
It may not make sense to write batch-test-runner in batch language.
Controls in execution rules can get out of control. it is hard to handle complex structures in batch language, I propose to write the test-runner in c# language.

Will students working offline need C# installed to test their exercises on this track?

Absolutly no, dotnet has build configuration named “self-contained” which puts depencies to folder so no need anymore network connection since we don’t use network in program.

What will students need to install (on Windows and on Linux) to test their solutions?

There may have been a little confusion.

“to test their solutions”

if we are talking about the result of this test localized for the student,
just downloading the zip from the releases section of the test-runner-batch repo and putting it in a folder is enough for testing, to make things easier you can write a batch script that adds that location to PATH.

but in a server-side test as I thought in the previous message, what I meant was that there is no dependency, i.e. in python for example, you need to download the dependencies with pip.

@GroophyLifefor So, to be clear, programs need to be testable. We need to determine if a student has achieved the objectives or not. This is normally done by calling functions/methods and checking their results. We don’t use “print” or “echo” anywhere at Exercism. So for example for “hello world”, take a look at the C# solution and test file

(Note that Hello World, and most of our exercises, are standardised across tracks, btw).

So we need a solution and a test file for the exercise, then we later we need a program that runs the tests and converts the output to a standardised format (you can read the docs for this: Test Runners | Exercism's Docs). We don’t need that program to get us started, but I need to confirm it’s an achievable thing to create that program and be able to run it on Linux :slight_smile:

…mostly. bash and awk do use STDOUT to output results and the tests capture that output.

Hello, thanks for response.
Firstly I have to say Batch Scripting Language doesn’t has a function functionality so normally doesn’t has an return. In batch we able to read output of commands so usually in a normal program too we can use reading stdout. Batch Scripting Language has label system which maybe you can remember from assembly or like this old languages. Works with GOTO and specialize a label putting double dot’:’ to before label like


And also I understand your point and I agree.
I will share my experiments as soon as possible with looking stdout because, yes it has more way to check but stdout most clean way.

I spent some time thinking about how to adapt to the exercism, I wrote some code and I had some difficulties. But now I will send you a few test-runner previews, I can also send you the source code if you want, I will only show visuals now in order to move slowly and cleanly.
It doesn’t support it as a parameter at the moment, I used the file path as a plain string, to make debugging easier.

Timeout (code: 408)

Stdout & Stderr Limitation (code: 413)

Fail (code: 1)

Passed (code: 0)

Test Case

xUnit result


Mine Test Code

I haven’t had a chance to try it on linux yet, but the code should be compatible there, it’s the unexpected issues that will cause problems. I’m sure I’ll get some very strange bugs from unexpected places :)

This means users will need to install .net and xUnit on their machines to test their code?