windows - Type command issue -
windows - Type command issue -
i have issue type command needs concatenate 2 files of same header , set file 2 info appended in file 1. operation done fine while executing batch script directly. when calling batch 3rd party tool (informatica cloud), type works rewrite. file 2 info overwrites file 1 data. can help me way out?
batch script:
if "%time:~0,1%"==" " (set hh=0%time:~1,1%) else set hh=%time:~0,2% set timestamp=%date:~10,4%%date:~4,2%%date:~7,2%%hh%%time:~3,2%%time:~6,2% re-create sample_transaction_inbound_veeva-i19.txt sample_transaction_inbound_veeva-i19_%timestamp%.txt /f "skip=1 delims=*" %%a in (f:\ots_veeva_crm\targetfiles\ing2\smpl\sample_order_transaction_inbound_veeva-i19.txt) ( echo %%a >>f:\ots_veeva_crm\targetfiles\ing2\smpl\remove_header\newfile.txt ) type f:\ots_veeva_crm\targetfiles\ing2\smpl\remove_header\newfile.txt >> f:\ots_veeva_crm\targetfiles\ing2\smpl\sample_transaction_inbound_veeva-i19_%timestamp%.txt rem echo "yes" | re-create /-y f:\ots_veeva_crm\targetfiles\ing2\smpl\remove_header\*.txt "%temp%" rem xcopy c:\newfile.txt c:\file.txt /y del f:\ots_veeva_crm\targetfiles\ing2\smpl\remove_header\newfile.txt /f /q f:\ots_veeva_crm\utilities\7z -y sample_transaction_inbound_veeva-i19_%timestamp%.zip sample_transaction_inbound_veeva-i19_%timestamp%.txt rem move sample_transaction_inbound_veeva-i19_%timestamp%.zip f:\ots_veeva_crm\targetfiles\ing2\sample_transaction_inbound_veeva-i19_%timestamp%.zip re-create f:\ots_veeva_crm\targetfiles\ing2\sample_transaction_inbound_veeva-i19_%timestamp%.zip f:\ots_veeva_crm\targetfiles\ing2_archive\sample_transaction_inbound_veeva-i19_%timestamp%.zip rem del f:\ots_veeva_crm\targetfiles\ing2\smpl\sample_transaction_inbound_veeva-i19_%timestamp%.txt
your problem default active directory. file references not include folder file stored , (at to the lowest degree in posted code) there no explicit pushd
or cd /d
, probably, there different default folder when batch file called 3rd party tool , files not found.
so solution should ensure adecuated folder selected default active directory (in sample below) or include paths in file references.
sorry, had rewrite follow logic
@echo off setlocal enableextensions disabledelayedexpansion if "%time:~0,1%"==" " (set hh=0%time:~1,1%) else set hh=%time:~0,2% set "timestamp=%date:~10,4%%date:~4,2%%date:~7,2%%hh%%time:~3,2%%time:~6,2%" set "inputfile1=sample_transaction_inbound_veeva-i19.txt" set "inputfile2=sample_order_transaction_inbound_veeva-i19.txt" set "combinedbasename=sample_transaction_inbound_veeva-i19_%timestamp%" set "combinedfile=%combinedbasename%.txt" set "zip=f:\ots_veeva_crm\utilities\7z.exe" set "outputfolder=f:\ots_veeva_crm\targetfiles\ing2_archive" set "sourcefolder=f:\ots_veeva_crm\targetfiles\ing2\smpl" pushd "%sourcefolder%" && ( re-create "%inputfile1%" "%combinedfile%" >>"%combinedfile%" ( /f "usebackq skip=1 delims=" %%a in ("%inputfile2%") @echo(%%a ) "%zip%" -y "%outputfolder%\%combinedbasename%.zip" "%combinedfile%" popd )
windows batch-file cmd informatica informatica-powercenter
Comments
Post a Comment