我有一个shell脚本,它使用week_01
和另一个名为week_09
的目录将目录for loop
设置为week_10
。我想使用两行代码将此shell脚本转换为Windows命令?
Shell脚本:
#!/bin/bash
for (( Y=1;Y<=9;Y++))
do
mkdir week_0$Y
done
mkdir week_10
答案 0 :(得分:2)
答案 1 :(得分:2)
试试这个:
@echo off &setlocal enabledelayedexpansion
for /l %%i in (101,1,110) do (
set "folder=%%i"
set "folder=week_!folder:~1!"
echo mkdir "!folder!"
)
答案 2 :(得分:2)
另一个!
@echo off & setlocal EnableDelayedExpansion
set folder=101
for /L %%i in (1,1,10) do (
mkdir week_!folder:~-2!
set /A folder+=1
)
答案 3 :(得分:1)
如果这确实是你的任务,那么这也会有效。
@echo off
for %%a in (01 02 03 04 05 06 07 08 09 10) do Mkdir "week_%%a"