Batch Script - Mid String Last Updated : 04 Jan, 2022 Comments Improve Suggest changes Like Article Like Report In this article , we are going to learn how to use the concept of Mid String using Batch Script. Using the concept of 'Mid String' we are extracting out a sub string between two indices of any given string. Batch Script :@echo off set str=GeeksforGeeks echo %str% set str=%str:~5,-5% echo %str% pause Using above code we are going to print a substring from 5 to -5 index from given string(i.e. GeeksforGeeks). Explanation :By using ' set ' we are getting input of any string.set str=GeeksforGeeksIn the next line using ' echo %str% ' we are printing our input string.Now in the next line using indexing we are going to eliminate characters from both ends.General Representation : set str=%string:~FROM, TO% .set str=%str:~5,-5% In the above representation we have to provide the index from which we want our new string till its ending index.In above code we have '5, -5' , so from index 5 which is 's' till index -5( negative indexing) which is 'G'.So the substring between these two indexes will be printed as output.Then we are using 'pause' , to hold the screen until any key is pressed , so that we can read our output. As we can clearly see that characters between '5' and '-5' is printed as output ,so using the following code we can use the concept of Mid String. Comment More infoAdvertise with us Next Article Batch Script - Mid String thenavneet Follow Improve Article Tags : Linux-Unix Batch-script Similar Reads Batch Script - Right String In this article, we are going to learn how to use the concept of Right String using Batch Script. Right String uses the concept of negative indexing. We have to extract the characters using :~ followed by the negative index of the character from which we want to print a substring from the main strin 2 min read Batch Script - Strings A Bash script is a plain text file. This file contains different commands for step-by-step execution. These commands can be written directly into the command line but from a re-usability perceptive it is useful to store all of the inter-related commands for a specific task in a single file. We can u 4 min read Batch Script - Empty String In this article, we are going to create an Empty String using Batch Script. Batch Script :@echo off set str1= set str2=Hello ::using if statement we will check that str1 is empty string or not. if [%str1%]==[] echo "str1 is an empty string" if [%str2%]==[] echo "str2 is an empty string" pauseExplana 1 min read Batch Script - Left String In this article, we are going to study Left string in Batch Script. In Batch Script, the Left string is used to extract the characters from the beginning of the string by giving position 0 and a length using:~ while expanding a variable content. Example 1: Batch script set str=GeeksForGeeks echo.%st 1 min read Batch Script - String length In this article , we are going to learn how to find length of any String using Batch Script. Batch Script :@echo off set str=Geeks For Geeks call :strLen str strlen echo String is %strlen% characters long pause exit /b :strLen setlocal enabledelayedexpansion :strLen_Loop if not "!%1:~%len%!"=="" set 2 min read Batch Script - Create String In this article, we are going to learn how to create a String using Batch Script. Batch Script :@echo off set str=Geeks for Geeks echo %str% pauseBy using ' set ' we are getting input of any string.Ex: set str=input stringIn the next line, we are using ' echo %str% ' for printing our input string.Th 1 min read Batch Script - toInt In the Batch script, every variable is considered as a string and optionally integers. We need numbers all the time especially when it comes to performing system operations. We might extract numbers from a string variable but performing operations on them are not the same and require some additional 3 min read Batch Script - Replace a String In this article, we are going to Replace a substring with any given string. Batch Script :@echo off set str=GFG is the platform for geeks. echo %str% set str=%str:the=best% echo %str% pause In the above example, we are going to replace 'the' by substring 'best' using %str:the=best% statement. Explan 2 min read Bash Scripting - String Bash String is a data type similar to integer or boolean. It is generally used to represent text. It is a string of characters that may also contain numbers enclosed within double or single quotes. Example: "geeksforgeeks", "Geeks for Geeks" or "23690" are strings Creating a String A basic declarati 2 min read Like