Learn batch script lufy January 21, 2022 <h4>strings</h4> <h5>get substring</h5> <pre>SET s=abcdefghijklmnopqrst<br /><br />ECHO %s:~3,1%<br /><br />REM # %<var_name>:~<start_index>,<length>%<br /><br />REM # what if with variable index and length?<br /><br />REM # copied from <a href="https://ss64.com/nt/syntax-substring.html">https://ss64.com/nt/syntax-substring.html</a> </pre> <pre>SET _startchar=2 SET _length=1 SET _donor=884777 CALL SET _substring=%%_donor:~%_startchar%,%_length%%% ECHO (%_substring%) </pre>
Comments (0)
Leave a Comment
No comments yet. Be the first to comment!