批处理文件创建目录结构
问题描述:
我需要一个帮助来在Windows中创建一个批处理文件。我有工作在詹金斯执行,我需要创建下面的目录结构:批处理文件创建目录结构
Product_4.1.1 --> this value is pass by parameter
|_4.1.1.00 --> I need remove the first part (Product_) and create a new sequence
|_4.1.1.01 --> I execute the job again, I need to create a new one directory
我创建了外壳的Linux这个过程中,但在Windows我没有sucess。
你能帮助我吗?
答
即使不成功,您也应该显示批处理代码。
只要在Product
没有强调了这一点应该做的:
@Echo off
:: Set Arg=%~1
set Arg=Product_4.1.1
Set "Version=%Arg:*_=_%"
Echo %Arg% %Version%
Set SubVer=100
:loop
If exist "%Version%.%SubVer:~-2%" (Set /A SubVer+=1 & goto :loop)
Echo Create "%Version%.%SubVer:~-2%"
Md "%Version%.%SubVer:~-2%"
你检查'MD /'? – npocmaka