Batch file http地址内的CMD解析

Batch file http地址内的CMD解析,batch-file,cmd,Batch File,Cmd,我为我的项目编写了一个批处理文件。我喜欢浏览我的svn http地址,这样我就可以知道我是在分支上工作还是在主干上工作。分支机构的名称也很有趣 我将搜索的路径如下所示: 我尝试使用“for”和“%variable:strofind=NewStr%”突击队。但我最终遇到了“/”、“:”字符的问题 有没有办法解决这个问题 谢谢 我尝试使用“for”和“%variable:strofind=NewStr%”突击队 输出: ==>set _ad Environment variable _

我为我的项目编写了一个批处理文件。我喜欢浏览我的svn http地址,这样我就可以知道我是在分支上工作还是在主干上工作。分支机构的名称也很有趣

我将搜索的路径如下所示:

我尝试使用“for”和“%variable:strofind=NewStr%”突击队。但我最终遇到了“/”、“:”字符的问题

有没有办法解决这个问题

谢谢

我尝试使用“for”和“%variable:strofind=NewStr%”突击队

输出

==>set _ad
Environment variable _ad not defined

==>D:\bat\SO\31209302.bat
_addr1=https://aaa.com/bbb/ccc/ddd/trunk/
_addr2=https://aaa.com/bbb/ccc/ddd/branches/thebranchname/
_addr3=https://aaa.com/bbb/ccc/ddd/branches/thebranchname
_adnew=branches/thebranchname
_adold=trunk/

==>
非常简单:

@ECHO OFF 

set "adress=https://aaa.com/bbb/ccc/ddd/trunk/"
call :Where %adress%

set "adress=https://aaa.com/bbb/ccc/ddd/branches/thebranchname"
call :Where %adress%

set "adress=https://aaa.com/bbb/ccc/ddd/neither/thebranchname"
call :Where %adress%

goto :eof

:Where
echo address: %adress%
echo %1|find /i "/trunk">nul && (echo I'm in Trunk & goto :eof)
echo %1|find /i "/branches">nul || (echo neither trunk nor branches & goto :eof)
set "branchname=%adress:*branches/=%"
echo I'm working for %branchname%
goto :eof

如何区分?“
主干
”与“
分支
”?这些是固定字符串吗?“主干”和“分支”是固定字符串,可以对它们进行解析。感谢您的解决方案。工作完美。
@ECHO OFF 

set "adress=https://aaa.com/bbb/ccc/ddd/trunk/"
call :Where %adress%

set "adress=https://aaa.com/bbb/ccc/ddd/branches/thebranchname"
call :Where %adress%

set "adress=https://aaa.com/bbb/ccc/ddd/neither/thebranchname"
call :Where %adress%

goto :eof

:Where
echo address: %adress%
echo %1|find /i "/trunk">nul && (echo I'm in Trunk & goto :eof)
echo %1|find /i "/branches">nul || (echo neither trunk nor branches & goto :eof)
set "branchname=%adress:*branches/=%"
echo I'm working for %branchname%
goto :eof