@If "%~1" equ ""  @Echo off
 rem -- #Doc0: see: \..\_JobMgrDefaults_TestAndHelp\CopyFromTo_Help.txt
 rem -- #Doc1: Example below will use copy function to copy S:\PLMDir\SourceDir\SourceFile.dat to C:\PLMDirLocal\TargetFile.dat
 rem -- #Exa1: Call CopyFromTo.cmd "Copy description" "S:\PLMDir\SourceDir" "SourceFile.dat" "C:\PLMDirLocal"  "TargetFile.dat"  ""
 rem -- #Doc2: Example below will use Robocopy function  robocopy /R:5 /W:1 /NP /NJS /NJH /NDL /NFL "S:\PLMDir\SourceDir" "C:\PLMDirLocal" "SourceFile.*" %CopyOpt%
 rem -- #Exa2: Call CopyFromTo.cmd "Copy description" "S:\PLMDir\SourceDir" "SourceFile.*" "C:\PLMDirLocal" "*.*"  ""


:begin
setlocal
  set Info_txt=%~1
  set S_DP=%~2
  set S_NE=%~3
  set T_DP=%~4
  set T_NE=%~5
  set CopyOpt=%~6
  set DoPrint=%~7

  rem --#Doc: check if S_DP and S_NE is to parse from P2
  if "%S_NE%" neq "" goto :Next
  set S_DP=%~dp2
  set S_DP=%S_DP:~0,-1%
  set S_NE=%~nx2

:Next
  if "%S_NE%" equ "" set S_NE=*.*
  if "%T_NE%" equ "" set T_NE=*.*

REM   if "%T_NE%" equ "*.*" set toRun=robocopy "%S_DP%" "%T_DP%" "%S_NE%" /R:5 /W:1 /NP /NJS /NJH /NDL /NFL %CopyOpt%
  if "%T_NE%" equ "*.*" set toRun=robocopy "%S_DP%" "%T_DP%" "%S_NE%" /R:5 /W:1 /NP /NJS /NJH %CopyOpt%
  if "%T_NE%" neq "*.*" set toRun=Copy /y %CopyOpt% "%S_DP%\%S_NE%" "%T_DP%\%T_NE%"
  set toRunForPrint=%toRun:"='%


REM   Call Echo2 "#Debug: DoPrint" "%DoPrint%"
  if /I "%DoPrint%" equ "PrintNo"  goto :PrintNo
  if /I "%DoPrint%" equ "PrintMin" goto :PrintMin
  goto :PrintYes

:PrintNo
  goto :NextDo

:PrintYes
REM   Call Echo2 "."
REM   Call Echo2 "#--#" "#--#"
  Echo.
  Call Echo2 "Copy Files for" "%Info_txt%"
  Call Echo2 "Do Copy via" "%toRunForPrint%"
  Call Echo2 "from Source dir" "%S_DP%"
  Call Echo2 "Source file" "%S_NE%"
  Call Echo2 "to Target dir"  "..%T_DP%"
  Call Echo2 "to Target file" "...%T_NE%"
  goto :NextDo

:PrintMin
REM   Call Echo2 "#--#" "#--#"
  Echo.
  Call Echo2 "Copy Files for"  "%Info_txt%"
  Call Echo2 "Copy Files from" "%S_DP%\%S_NE%"
  Call Echo2 "Copy Files to"   "..%T_DP%\%T_NE%"
  goto :NextDo

:NextDo
  if not exist "%S_DP%" goto :DirNotFoundErr
  if not exist "%T_DP%" md "%T_DP%"
  if not exist "%T_DP%" goto :DirNotFoundErr

  if /i "%JobMgr_Debug%" neq "ON" goto :JumbOverDebug
   call Echo2 "#D start after Key pressed" "%toRunForPrint%"
   pause
  :JumbOverDebug


if /I "%DoPrint%" equ "PrintNo" goto :PrintNo
if /I "%DoPrint%" equ "PrintMin" goto :PrintMin
goto :PrintYes

:PrintNo
:PrintMin
  if /I "%DoPrint%" equ "PrintNo" Call %toRun% 1>nul 2>nul
  set CopyFromTo_r=%errorlevel%
  goto :MyEnd

:PrintYes
  if /I "%DoPrint%" neq "PrintNo" Call %toRun%
  set CopyFromTo_r=%errorlevel%
  goto :MyEnd

:DirNotFoundErr
  Call ColorSet "ERR"
  if not exist "%S_DP%" Call Echo2 "ISSUE:from Source Dir not exist" "%S_DP%"&set CopyFromTo_r=100&Goto :Next
  if not exist "%T_DP%" Call Echo2 "ISSUE:to Target Dir not created" "%T_DP%"&set CopyFromTo_r=200&Goto :Next
  :Next
  if /i "%JobMgr_Debug%" equ "ON" pause
  if /i "%JobMgr_Debug%" neq "ON" timeout /T:5
  goto :MyEnd

:MyEnd
endlocal& set CopyFromTo_r=%CopyFromTo_r%

