- Windows batch script: substring calculation
- @SET str1="http://www.domain.com/dir1/dir2/dir3/dir4/dir5/file1.txt"
- @ECHO %str1:~37,-1%
- @echo off
- set str1="http://www.domain.com/dir1/dir2/dir3/dir4/dir5/file1.txt"
- :: remove the common part of the path
- set str2=%str1:http://www.domain.com/dir1/dir2/dir3=%
- :: remove the quotes
- set str2=%str2:"=%
- echo.%str2%
- /dir4/dir5/file1.txt