Batch Script - Remove All Spaces Last Updated : 28 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we are going to see how to remove all spaces from any string using Batch String. Example : Input: G e e k s f o r G e e k s Output: GeeksforGeeksApproach :By using ' set ' we are getting input of any string.Example: set str=input stringIn the next line using ' echo %str% ' we are printing our input string.In the next line of code, we are going to remove all spaces in the input string.Using ' := ' operator we are removing spaces in any string.We have to type any character between and = to remove that character from any given input string.For example: str=%str:e=% (this will remove e from the input string)So for removing spaces we will use ' : = ' .' pause ' is used to hold the screen until any key is pressed. Code: @echo off set str=G e e k s f o r G e e k s echo %str% set str=%str: =% echo %str% pause Output: batch script to remove all spaces. Comment More infoAdvertise with us Next Article Batch Script - Remove Both Ends T thenavneet Follow Improve Article Tags : Linux-Unix Batch-script Similar Reads 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 Batch Script - Remove Both Ends In this article, we are going to learn how to remove characters from both ends of any given string using Batch Script. Code :@echo off set str=Geeks for Geeks echo %str% set str=%str:~1,-1% echo %str% pauseBy using ' set ' we are getting input of any stringset str=input stringIn the next line using 1 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 - Align Right We can use Batch scripting for manipulating the data. We have certain commands and filters to manipulate and edit certain pieces of data very easily for better visualization. Align Right in Batch scripting is one of the commands/filters that helps in aligning or arranging text in a desired manner. U 3 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 - Mid String 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 2 min read Like