BATCH SCRIPTING // STRINGS IN BATCH SCRIPT // Batch Scripting Part- 10 - STRINGS

Publicado el: 03 junio 2020
en el canal de: Techno Puffin
1,607
15

Go and check out course on Udemy for PowerShell:
https://www.udemy.com/course/powershe...
********************************************************************************************
Title: BATCH SCRIPTING // STRINGS IN BATCH SCRIPT // Batch Scripting Part- 10 - STRINGS


In this lesson, you will be learning about STRINGS in Batch Script.


In DOS, a string is an ordered collection of characters, such as "Hello, World!".


CREATE STRING: A string can be created in DOS in the following way.


Example
@echo off
set message = Hello World
echo %message%


Output
Hello World

EMPTY STRING: An empty string can be created in DOS Scripting by assigning it no value during it’s initialization as shown in the following example.


Set a=
To check for an existence of an empty string, you need to encompass the variable name in square brackets and also compare it against a value in square brackets as shown in the following example.


[%a%]==[]
The following example shows how an empty string can be created and how to check for the existence of an empty string.


Example
@echo off
SET MESSAGE=
SET BUNT=Hello
if [%MESSAGE%]==[] echo "String MESSAGE is empty"
if [%BUNT%]==[] echo "String BUNT is empty "




Output
The above command produces the following output.
String MESSAGE is empty




STRING INTERPOLATION: String interpolation is a way to construct a new String value from a mix of constants, variables, literals, and expressions by including their values inside a string literal.


In DOS scripting, the string interpolation can be done using the set command and lining up the numeric defined variables or any other literals in one line when using the set command.


The following example shows how a string interpolation can be done with numeric values as well.


Example
@echo off
SET a = Hello
SET b = World
SET /A d = 50
SET c=%a% and %b% %d%
echo %c%


Output
The above command produces the following output.
Hello and World 50


STRING CONCATENATION :You can use the set operator to concatenate two strings or a string and a character, or two characters. Following is a simple example which shows how to use string concatenation.


Example
@echo off
SET a = Hello
SET b = World
SET c=%a% and %b%
echo %c%


Output
The above command produces the following output.
Hello and World
=======================================================


If you have any questions, please post them. Don't forget to comment, like, rate and subscribe


=====================================================


Batch file programming tutorial // CREATE BATCH FILE // Batch Scripting Part-1 --    • Batch file programming tutorial // CR...  


Batch file programming tutorial // Batch Scripting Part-2 - Basic Batch Commands --    • Batch file programming tutorial // Ba...  


Batch file programming tutorial // COPY COMMAND // Batch Scripting Part-3 - COPY Batch Command --    • Batch file programming tutorial // CO...  


Batch file programming tutorial // DEL COMMAND // Batch Scripting Part-4 - DEL Batch Command --    • Batch file programming tutorial // DE...  


Batch file programming tutorial // MOVE COMMAND // Batch Scripting Part-5 - MOVE Batch Command --    • Batch file programming tutorial //MOV...  


Batch file programming tutorial // ATTRIB COMMAND // Batch Scripting Part-6 - ATTRIB Batch Command --    • Batch file programming tutorial // AT...  


Batch file programming tutorial // FIND COMMAND // Batch Scripting Part-7 - FIND Batch Command --    • Batch file programming tutorial // FI...  


Batch file programming tutorial // VARIABLES IN BATCH SCRIPT // Batch Scripting Part- 8 - VARIABLES --    • Batch file programming tutorial // VA...  


DO NOT CLICK // LOCAL AND GLOBAL VARIABLES IN BATCH SCRIPT // Part- 9 - LOCAL AND GLOBAL VARIABLES --    • DO NOT CLICK // LOCAL AND GLOBAL VARI...  


======================================================
Check out other videos


WEAPONS THAT CAN DEFEAT THANOS -- https://www.youtube.com/watch?v=nvlez


MS PAINT TRICK -- https://www.youtube.com/watch?v=4IvBC


Matrix Effect --    • Matrix Rain Best Trick// Create Matri...  


En esta página del sitio puede ver el video en línea BATCH SCRIPTING // STRINGS IN BATCH SCRIPT // Batch Scripting Part- 10 - STRINGS de Duración hora minuto segunda en buena calidad , que subió el usuario Techno Puffin 03 junio 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 1,607 veces y le gustó 15 a los espectadores. Disfruta viendo!