How to split string using batch file?

馋奶兔 提交于 2019-12-02 05:06:20

You may split strings by character position:

ECHO %java_path:~1,16%

or by splitting at specific characters:

FOR /F "DELIMS=\ TOKENS=1,2" %i IN (%java_path%) DO ECHO %i\%j

try this:

@ECHO OFF &SETLOCAL
SET "java_path=C:\Program Files\Java\jdk1.6.0_31"
SET "this=%java_path:~3%"
SET "this=%this:*\=%"
CALL SET "this=%%java_path:%this%=%%"
SET "this=%this:~0,-1%"
ECHO %this%
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!