Collections:
Other Resources:
Get Sub-String from Variable
How to get a sub-string from a string batch variable?
✍: FYIcenter.com
You can get a sub-string from a string batch variable
using the following variable modifier:
%variable~i,l%
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%
⇒ Batch Command Help Reference Documents
⇐ String Variable Match and Replace
2021-10-10, ∼2248🔥, 0💬
Popular Posts:
A new tab called "Boot" is added in "msconfig" tool on Windows Vista and Windows 7. What is this "Bo...
Why I am getting this "Microsoft Silverlight Update" pop up window? If you have Silverlight 2.0 inst...
What is the scheduled task "\Microsoft\Windows\Sett ingSync\BackgroundUpload Task"on my Windows 8 com...
Can I remove startup application "tfswctrl.exe - Sonic Drive Letter Access Component" to speedup my ...
What is AcroIEHelper.dll - DLL file - Adobe Acrobat IE Helper Version 6.0 for ActiveX? DLL AcroIEHel...