Code: Select all
@echo off
echo.going to execute myDosFunc with different arguments
set fdl_1=function1
set fdl_2=function2
set fdl_3=function3
call:myDosFunc %fdl_1% *xt1.txt
call:myDosFunc %fdl_2% *xt2.txt
call:myDosFunc %fdl_3% *xt3.txt
goto:eof
::--------------------------------------------------------
::-- Function section starts below here
::--------------------------------------------------------
:myDosFunc - here starts my function identified by it's label
cd C:\Users\test
if exist %~1 (
cd %~1
copy %~2 C:\Users\test\function\
)
goto:eof
Now I use the similar code to do this following job and failed to do so, can not figure out why?
Code: Select all
set NAR_COMP_6=NAR KIA Tetra 0521
set NAR_COMP_7=NAR Applications
set NAR_COMP_8=NAR TSA Tetra 0521
call:convertFunc %NAR_COMP_6% *KIA.P3A
call:convertFunc %NAR_COMP_7% *852046.P3A
call:convertFunc %NAR_COMP_8% *TSA.P3A
goto:eof
::--------------------------------------------------------
::-- Function section starts below here
::--------------------------------------------------------
:convertFunc - here starts Convert function
cd "%NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%NEW_PKG_PART_NO%\Factory Download\TETRA\TELIUM3"
if exist %~1 (
cd %~1
copy %~2 C:\auto_mockup_pkg\Tools\PACKAGER\
)
goto:eof
cd "%NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%NEW_PKG_PART_NO%\Factory Download\TETRA\TELIUM3"
But I had variable input for all the %NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%NEW_PKG_PART_NO%\Factory Download\TETRA\TELIUM3
After run, prompt to %NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%NEW_PKG_PART_NO%\Factory Download\TETRA\TELIUM3 that mean cd is working correctly
But nothing happened...
when I comment out if exist %~1 (
it complain
The system cannot find the path specified. (for cd %~1)
The system cannot find the file specified.. (for copy %~2 C:\auto_mockup_pkg\Tools\PACKAGER\)
Physically checked the folders are there and files too, Any reason why I can not do it ...
Thanks