Get Sub-String from Variable
How to get a sub-string from a string batch variable?
You can get a sub-string from a string batch variable using the following variable modifier:
In the above expression, "i" is the offset position of the sub-string to be extracted, and "l" is the length of the sub-string to be extracted.
If "i" is negative, the offset is counted from the end of the string. If "l" is negative, the length is the calculated from total number of characters in the string.
Examples of sub-string modifiers:
rem Get 5 characters starting from 11th set test=%java_home:~10,5% rem Get last 10 characters set test=%java_home:~-10% rem Get all characters except the last 2 characters set test=%java_home:~0,-2%
2017-12-05, 267👍, 0💬
Can I disable Windows service "HTTP SSL" to speedup my computer? Windows service "HTTP SSL" - This s...
How to configure PHP execution environments? If you followed our Downloading PHP Engine tutorial, yo...
How to open a Web Archive (.mht or .mhtml) file correctly in Firefox browser? I converted a word doc...
What files are stored in the "C:\Users\<userid >\AppData\Local\M icrosoft\Windows\Tempor. ..
How to create your PHP configuration file, php.ini? If you have followed our Installing PHP Engine t...