0
我想下面的UNIX shell腳本轉換爲Windows:轉換Unix到Windows shell腳本
for strWorkerDirectory in $BASEDIR/worker01/applogs $BASEDIR/worker01/filtered $BASEDIR/worker01/filtered/error-logs $BASEDIR/worker01/filtered/logs $BASEDIR/worker01/filtered/session-logs
do
if [ ! -d $strWorkerDirectory ]; then
mkdir -p $strWorkerDirectory
fi
done
到目前爲止,我想出了這個:
FOR %%strWorkerDirectory IN (%BASEDIR%worker01\applogs %BASEDIR%worker01\filtered %BASEDIR%worker01\filtered\error-logs %BASEDIR%worker01\filtered\logs %BASEDIR%worker01\filtered\session-logs) DO
(
IF exist %%strWorkerDirectory (echo %%strWorkerDirectory exists) ELSE (mkdir %%strWorkerDirectory && echo %%strWorkerDirectory created)
)
,但我收到錯誤消息剛剛說了什麼是錯在這裏
"%strWorkerDirectory" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
什麼是正確的轉換嗎?
插入符號(續行)在IN子句中不需要。 IN子句的圓括號允許換行。 – dbenham
@dbenham恩,謝謝。我非常熱衷於說明我錯過了那一條(通常未被充分利用)的延續線。 ;-) –