1

UPDATE: THE PROBLEM IS SOLVED. :)

I want to trim a variable value in windows command prompt.

I used--

set str=sourav
echo %str:~0,3%

as mentioned on an online tutorial.

output-- sou

Can someone explain how this works? I mean how the colon and ~ are working here?

Sourav Ghosh
  • 1,964
  • 4
  • 33
  • 43

1 Answers1

1

(Answered in the comments. See Question with no answers, but issue solved in the comments (or extended in chat) )

@foxidrive wrote:

In a cmd prompt type set /? and read the help. It is explained in there.

@mofi noted its a duplicate of:

What is the best way to do a substring in a batch file?

Community
  • 1
  • 1
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129