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,884
  • 4
  • 31
  • 42

1 Answers1

0

(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,438
  • 68
  • 55
  • 126