Understanding a batch script for improvisation

Viewed 24

I thrive on angular, html and css so basically I'm on UI but I've been asked to look into a batch script and improvise it as a part of a proof of concept Below is the script, I've tried as much as I could to understand by going through multiple links but I'm finding it really hard to connect the dots from start to finish

It will be a great help if someone could explain me this script

setlocal enabledelayedexpansion
for %%f in ("%WORKSPACE%\Tests\*.sql") do (
    for /F "tokens=1 delims=." %%a in ("%%~nxf") do (
        SET _schema=%%a
        IF "!_schema:~0,4!"=="test" (
            IF NOT "!_schema:~0,4!"=="test " (
                SQLCMD -S "%DBSERVER%" -E -d "%DBNAME%" -Q "IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = '!_schema!') EXEC tSQLt.NewTestClass @ClassName = N'!_schema!'"
                )
            )
        )
    SQLCMD -S "%DBSERVER%" -E -d "%DBNAME%" -i "%%f"
)
0 Answers
Related