I am automating RSA soft token conversion and passing the conversion string over to Outlook. I realize I cannot make the string into a URL using a batch to outlook command line, however that is not my issue. My issue is converting the pesky equal sign over to it's URL encoded equivalent, "%3D".
@echo off
setlocal enableDelayedExpansion
set /p fname=Enter the Filename:
set /p pss=Enter the encryption pass:
IF NOT EXIST "%fname%".sdtid (
echo File Not Found! Closing...
PING 1.1.1.1 -n 4 >NUL
exit
)
echo File Found! starting process...
REM tokenconverter %fname%.sdtid -iphone >> temp_batch.txt
tokenconverter %fname%.sdtid -p %pss% -iphone >> temp_batch.txt
set /p result= < temp_batch.txt
DEL temp_batch.txt
REM %result% | clip
set "stringclean1=!result:?=%%3F!"
set "stringclean2=!stringclean1::=%%3A!"
set "stringclean3=!stringclean2:/=%%2F!"
The following line fails to encode the equal sign:
set "stringclean4=!stringclean3:==%%3D!"
I've tried:
set "stringclean4=!stringclean3:=^=%%3D!"
set "stringclean4=!stringclean3:=%=%%3D!"
However the equal sign remains unencoded.
echo Piping over to outlook..
REM passing stringclean3 since stringclean4 no worky.
pushd "C:\Program Files\Microsoft Office\Office12"
outlook.exe /c ipm.note /m "&subject=TEsT&body=%stringclean3%"
What is the proper way to URL encode the equal sign using delayed variable expansion?
Any assistance is appreciated. Thanks in advance.