Windows Batch Script: string operations








  • substring:
    set "var=apple pear"
    
    echo %var~6,4%
    REM pear
    
    echo %var~0,-5% 
    REM apple
    
  • replace character:
    set "var=a,b,c"
    
    REM replace commas with spaces
    echo %var:,= %
    REM a b c
    


see also




No comments:

Post a Comment