, .
: , .
.
call foo.bat password
Foo.bat -----------------
Setlocal EnableDelayedExpansion
Echo !password!
EDIT: ,
CALL .
- CALL foo.bat %preparedVariable%
, CALL foo.bat !preparedVariable!
CALL.
CALL.
@echo off
setlocal DisableDelayedExpansion
rem set /p "complex=Complex Input "
set "complex=xx! & "!^&"ab^^ " ^^^^cd%%"
setlocal EnableDelayedExpansion
call :prepareForCallBatch complex PreparedParam
echo Send =!PreparedParam!#
set complex
echo(
call ShowParam.bat %%PreparedParam%%
exit /b
:: Prepare special characters &|<>"^ for a batch call
:prepareForCallBatch
set "temp=!%~1!"
set "temp=!temp:^=^^!"
set "temp=!temp:&=^&!"
set "temp=!temp:|=^|!"
set "temp=!temp:<=^<!"
set "temp=!temp:>=^>!"
set "temp=!temp:"=^^"!"
set "%~2=!temp!"
exit /b
ShowParam.bat, -
ShowParam.bat
@echo off
setlocal
set prompt=
@echo on
REM