Can anyone explain what is :~1%
in the below statement in a batch file? I assigned the value of %variable
to servername and tried echo %variable
. I get the same server name as output. Can anyone explain how the statement below works?
set variable=%variable:~1%
this is notation for subs string expansion , look at this out put form command line you will understand.
if you have not understood , here is syntax (in my words)
where
OptionalLenghtOfCharctors
by default it takes remaining characters of string.It's a syntax for substrings from the variable contents, in this case it removes the first character.
See
set /?
for help