@echo off & setlocal EnableDelayedExpansion
echo 准备生成ETL导入和编译脚本....
pause
if exist 1_import.bat del 1_import.bat
if exist 2_compile.bat del 2_compile.bat
set "import_pre=dscmdimport.exe /H=10.31.24.14 /U=annetl /P=Paic1234"
set "compile_pre=dscc /H 10.31.24.14 /U annetl /P Paic1234"
set "dir_path=C:"
set "soft_path=CD C:\Program Files\Ascential\DataStage7.5.2\"
echo %dir_path%>>1_import.bat
echo %soft_path%>>1_import.bat
echo %dir_path%>>2_compile.bat
echo %soft_path%>>2_compile.bat
for /f "delims=" %%i in ('"dir /ad/b/on "') do (
set folder_path=%%~fi
set folder_name=%%i
for /f "delims=" %%j in ('"dir /a/s/b/on !folder_path!\*.dsx"') do (
set file_name=%%~nj
set file_path=%%~fj
::echo !pre! !folder_name! !file_path!
echo !import_pre! !folder_name! !file_path!>>1_import.bat
echo !compile_pre! !folder_name! /J !file_name!>>2_compile.bat
))
echo pause>>1_import.bat
echo pause>>2_compile.bat
echo 生成脚本1_import.bat和2_compile.bat成功
pause