Ok. Sometimes ya just want to get it done!
Standing on the shoulders of giants (HERE)...
Most of this code is the direct result of questions answered right here in this forum!
Thank you all for the knowledge you have passed on so willingly.
There are three files involved.
The first batch file STARTs the other batch file.
The third file is the storage place for the passed arguments.
I still hope there is a way to more easily pass arguments with the START command, but sometimes...
PassArgs.bat --> RecArgs.bat
Repository.ARGS
Here is the Passing Program:
@echo off
echo ---- PassArgs.bat ----
Echo Arg1 > Repository.ARG
Echo Arg2 >> Repository.ARG
start "Passing Arguments" RecArgs ^&^& exit
((((echo Just waiting for...) & echo RecArgs ) & echo Oh look. It's done!.) & echo.)|MSG /time:5 *
echo That's All Folks!
echo.
And here is the receiving batch program:
@echo off
echo ---- RecArgs.bat ----
cd /d "%~dp0" && setlocal EnableDelayedExpansion
for /f ^tokens^=*delims^= %%i in ('type Repository.ARGS')do set /a "_c+=1+0" && <con: set "Arg!_c!=%%~i"
for /l %%l in (1 1 !_c!)do echo\Arg%%l=!Arg%%l!
%__AppDir__%timeout.exe -1 & endlocal & goto=:EOF
echo Arg1=%Arg1%
echo Arg2=%Arg2%
Echo I got them!
echo.
pause
The end result is arguments Arg1 and Arg2 passed to the STARTed program.
Arg1="Arg1"
Arg2="Arg2"
^&^& exit
is unneeded and useless.