vendredi 20 juillet 2018

Asterisk Expansion in Batch

I am writing a batch script that is checking if a passed in parameter (for a git branch) matches a specific type of branch. Here is the code I have:

@echo off
if %Branch% == "refs/topics/*" (
    echo yes
)
if not %Branch% == "refs/topics/*" (
     echo no
)

This is just a simple example of what it's supposed to do within the if/else condition branches, but the problem that I'm facing is when I'm passing a parameter that's supposed to go into the "yes" branch, it still goes into the "no" branch. Here is the parameter that I'm passing: refs/topics/tester

Which, theoretically, it should be the same as refs/topics/ with the asterisk expansion. What am I doing wrong here and how can I fix it to check correctly?

Aucun commentaire:

Enregistrer un commentaire