Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how concatenate two variables in batch script?

Tags:

People also ask

What does %% do in batch?

Use double percent signs ( %% ) to carry out the for command within a batch file. Variables are case sensitive, and they must be represented with an alphabetical value such as %a, %b, or %c. Required. Specifies one or more files, directories, or text strings, or a range of values on which to run the command.

What is && in batch?

&& runs the second command on the line when the first command comes back successfully (i.e. errorlevel == 0 ). The opposite of && is || , which runs the second command when the first command is unsuccessful (i.e. errorlevel != 0 ).

What is %1 in a batch file?

When used in a command line, script, or batch file, %1 is used to represent a variable or matched string. For example, in a Microsoft batch file, %1 can print what is entered after the batch file name.


I want to do something like this in batch script. Please let me know if this is the proper or possible way to do it or any other way?

set var1=A

set var2=B

set AB=hi

set newvar=%var1%%var2%

echo %newvar%  

This should produce the value "hi".