Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 0.38 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Windows batch script: substring calculation
  2. @SET str1="http://www.domain.com/dir1/dir2/dir3/dir4/dir5/file1.txt"
  3. @ECHO %str1:~37,-1%
  4.        
  5. @echo off
  6. set str1="http://www.domain.com/dir1/dir2/dir3/dir4/dir5/file1.txt"
  7.  
  8. :: remove the common part of the path
  9. set str2=%str1:http://www.domain.com/dir1/dir2/dir3=%
  10. :: remove the quotes
  11. set str2=%str2:"=%
  12.  
  13. echo.%str2%
  14.        
  15. /dir4/dir5/file1.txt