Thursday, August 25, 2011

cmd variables tricks

Get the variable value with replaced part to some new string:
%variable:wildcard_string=new_string%
Get only part of the variable:
%variable:~num_chars_to_skip%
%variable:~num_chars_to_skip,num_chars_to_keep%
%variable:~num_chars_to_skip_from_start, -num_chars_to_skip_from_end%
%variable:~-num_chars_to_skip_from_end,num_chars_to_keep%
%variable:~-num_chars_to_skip_from_end,-num_chars_to_skip_from_end%
other variable substitutions can be found in the command-line reference

No comments:

Post a Comment