我有shell脚本(sh),下面的行需要写入相当于windows bat文件的行。任何身体帮助
**shell script:**
cd $AUTOMATEDTESTHTTPDIR/../abc/Input
for i in `ls -d *`
do
cd $i
cp * ../../def/Unidentified/Requests
cd ..
done
cd $AUTOMATEDTESTHTTPDIR/../abc/Output
for i in `ls -d *`
do
cd $i
cp * ../../def/Unidentified/Responses
cd ..
done
cd $AUTOMATEDTESTHTTPDIR/../def/Deliver
for d in test1\
test2\
test3\
do
mkdir $d
for e in Requests \
Responses
do
mkdir $d/$e
mv Unidentified/$e/*$d* $d/$e
done
done
如何在windows bat中写上面的行。
答案 0 :(得分:0)
这是一个粗略的打击。这是未经过测试的,但它包含了您需要的大部分内容。有关循环的更多信息,请在cmd shell提示符处使用FOR /?
。
CD %AUTOMATEDTESTHTTPDIR%\..\abc\Input
FOR /F "usebackq tokens=*" %%i IN (`dir /ad *`) DO (
CD "%%i"
COPY * ..\..\dev\Unidentified\Requests
CD ..
)
CD %AUTOMATEDTESTHTTPDIR%\..\abc\Output
FOR /F "usebackq tokens=*" %%i IN (`dir /ad *`) DO (
CD "%%i"
COPY * ..\..\dev\Unidentified\Requests
CD ..
)
CD %AUTOMATEDTESTHTTPDIR%\..\def\Deliver
FOR %%d IN (test1 test2 test3) DO (
MKDIR "%%d"
FOR %%e IN (Requests Responses) DO (
MKDIR "%%d\%%e"
MOVE "Unidentified\%%e\*%%d*" "%%d\%%e"
)
)