Windows 10

How To Concatenate Variables In Windows Batch File

In this tutorial, we are going to see how to concatenate variables in Windows batch file. The batch file contains a series of DOS (Disk Operating System) instructions. It allows triggering the execution of commands found in this file.
 

How To Concatenate Variables In Windows Batch File

The following example concatenate the three variables www, var1 and var2:

@echo off

set www=StackHowTo

set "var1=----->"
set "var2=<-----"
set "str=%var1%%www%%var2%"

echo "%str%"

Output:

"----->StackHowTo<-----"

 

Leave a Reply

Your email address will not be published. Required fields are marked *