DDK
DDK

Reputation: 1038

Manipulating string in cmd prompt

Suppose I have a environment variable like version with valueVersion-1-0-12-1. How can I convert it to a string format like 1.0.12.1 from the command prompt ? The shell equivalent would be to use IFS. How to do it in Windows command prompt?

Upvotes: 0

Views: 96

Answers (1)

Endoro
Endoro

Reputation: 37569

Try this :

set "var=Version-1-0-12-1"
set "var=%var:*-=%"
set "var=%var:-=.%"
echo %var%

Upvotes: 2

Related Questions