Knowledge Walls
John Peter
Pune, Maharashtra, India
Things to Know [cont'd]
Split string by delimiter in String manipulation of MS-DOS Commands
111113 Views
How to split string by delimiter in ms dos batch script file 
Here in this example , (comma) is the delimiter in a string. It is assigned on  the variable. Using FOR IN.. ms dos batch file command to get multiple splited values using %%a,%%b,%%c and %%d.
Example
@echo off

SET data=one,two,three,four
FOR /f "tokens=1,2,3,4 delims=," %%a IN ("%data%") do echo %%a&echo %%b&echo %%c&echo %%d

SET /p exit=Press any key to exit
Output 
Next Topics
Next lessons of current book.
Things to Know of MS-DOS Commands
Previous Topics
Previous lessons of current book.
String manipulation of MS-DOS Commands
String manipulation of MS-DOS Commands
String manipulation of MS-DOS Commands
String manipulation of MS-DOS Commands
Best Lessons of "MS-DOS Commands"
Top lessons which are viewed more times.
Arithmetic Operators of MS-DOS Commands
Arithmetic Operators of MS-DOS Commands
String manipulation of MS-DOS Commands
Relational Operators of MS-DOS Commands
String manipulation of MS-DOS Commands
String manipulation of MS-DOS Commands
Things to Know of MS-DOS Commands
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details