@steve6375, I have tested your script, works good.
Only redirect to memory has certain limitations regarding grub4dos operators inside VARIABLE, but I expect they can be overcome with ''pause --wait=0" to not expand color codes and use pause --wait=0 "%VARIABLE%" > (md).... plus some corrections in the search-length of cat --locate
Sadly there seems no real solution for unequal number of double quote chars (so not \x22 but the 'hard' " ) which would be very, very useful.
Please correct me if I am wrong...
---------------------------------------------------------------------------------------------------------------------------------------
During traffic today I did some investigations on my smartphone about the behavior of call Fn.11 and also in combination with echo %@retval% and with read %@retval% too.
It seems that call Fn.11 has no 'limit' (like cat --locate) for the length of the 'phrase' searched in %VARIABLE% (so maybe max 511 chars?). I tested up to 72 chars:
BTW in sixth line before end the initial var-text is simply doubled
Trying to read-out a variable containing \x22 with %@retval% on a new line: no results
In cases if two \x22\x22 however the value of %@retval% gave some interesting results:
It seems the memory address in %@retval% is some cmd-buffer, quickly overwritten by the cat --hex I used to read-out. But some remains of the Fn.11-call are still visible.
After a calculation with CALCD.G4B (can be done with calc too of course) read %@retval% is showed, giving some information about the FN.11-call. Also a corroboration of what steve6375 said about expanding of \x with ASCII-code.
I followed this trail a while, the 32-bits value of read %@retval% seems to include information about searched 'phrase' and the first 'found'. Also space between %VARIABLE% and phrase becomes a zero and last double-quote around "%VARIABLE%" too (if used):
The weird behavior of \x22 in the variable and searching for \x00 \x09 \x0A and \x0D has something to do with expansion of \x00 \x09 \x0A and \x0D too. This became more clear to me when \x20 in variable was not found if 'phrase' \x20 was without double-quotes (lines 4-9):
BTW \x20 in %VARIABLE% without double-quotes does not seem to be affected (not fully fully sure, but normally I use "%VARIABLE%" and "phrase").
The behavior of \x20\x22\x20 versus \x20\x22 or \x22\x20 seems to me explained in the variation of the remaining number of double-quotes through expansion and not enough remaining double quotes around \x0A:
BTW the last line in last print-screen showing \x0A is different if for instance \x0B is searched - not fully clear for me somehow.
Can not show more print-screens because I reached some upload-limit of reboot.pro