2013-05-28 29 views
2

我有這個批處理腳本,我正在調用另一個批處理腳本「Strip_Batch.bat」並傳遞%Stripped_Name%變量作爲參數。但是這個參數不起作用。任何想法如何我可以通過這個變量?延遲擴展不適用於for循環

@echo off 
setlocal enableextensions enableDelayedExpansion 
set CONFIGURATIONS=HAVING_FUN_WITH_COLLEGUES 
for %%i in (%CONFIGURATIONS%) do (
set Original_Name=%%i 
echo !Original_Name! 
set Stripped_Name=!Original_Name:~0,-14! 
echo !Stripped_Name! 
call Strip_Batch.bat %%i %Stripped_Name% 
if errorlevel 1 goto error_exit 
) 

:the_end 
endlocal 
exit /b 0 

:error_exit 
endlocal 
exit /b 1 
+2

'叫Strip_Batch.bat %%我!Stripped_Name!'。 – Endoro

+0

對不起,它也沒有工作:-( – user1787480

+2

'調用Strip_Batch.bat「%%我」「!Stripped_Name!」':) – Endoro

回答

1

根據我的評論我首先建議:

call Strip_Batch.bat %%i !Stripped_Name! 

和第二(更好的,作品也與空間參數):

call Strip_Batch.bat "%%i" "!Stripped_Name!"