Page 1 of 1

How escape a pipe ?

Posted: 18 Jun 2020 15:34
by einstein1969
Hi to all,

I have a problem with this code

Code: Select all

for /f "delims=" %I in ('mshta "about:<OBJECT id=HTMLDlgHelper classid="CLSID:3050F4E1-98B5-11CF-BB82-00AA00BDCE0B"></OBJECT><SCRIPT language="VBSCRIPT">Sub window_onload : a=HtmlDlgHelper.object.openfiledlg("C:\windows.iso", ,"*.iso|","Select"): CreateObject("Scripting.FileSystemObject").GetStandardStream(1).WriteLine a : msgbox a : close : end sub</SCRIPT>"') do @echo %I
I need to escape the pipe in the part "*.iso|". I have tried with a classic caret ^ but not work for me.

-

Re: How escape a pipe ?

Posted: 19 Jun 2020 01:56
by miskox
Does it work If you add ^ ?

Code: Select all

for /f "delims=" %I in ('mshta "about:<OBJECT id=HTMLDlgHelper classid="CLSID:3050F4E1-98B5-11CF-BB82-00AA00BDCE0B"></OBJECT><SCRIPT language="VBSCRIPT">Sub window_onload : a=HtmlDlgHelper.object.openfiledlg("C:\windows.iso", ,"*.iso^|","Select"): CreateObject("Scripting.FileSystemObject").GetStandardStream(1).WriteLine a : msgbox a : close : end sub</SCRIPT>"') do @echo %I
Saso

Re: How escape a pipe ?

Posted: 19 Jun 2020 03:41
by T3RRY
I can't test in full if it's the intended outcome, however an additional escaping of the pipe prevents the syntax error.
So ^^^| as opposed to ^|

Code: Select all

for /f "delims=" %I in ('mshta "about:<OBJECT id=HTMLDlgHelper classid="CLSID:3050F4E1-98B5-11CF-BB82-00AA00BDCE0B"></OBJECT><SCRIPT language="VBSCRIPT">Sub window_onload : a=HtmlDlgHelper.object.openfiledlg("C:\windows.iso", ,"*.iso^^^|","Select"): CreateObject("Scripting.FileSystemObject").GetStandardStream(1).WriteLine a : msgbox a : close : end sub</SCRIPT>"') do @echo/"%I"

Re: How escape a pipe ?

Posted: 19 Jun 2020 13:29
by einstein1969
ok
the triple caret ^^^ work well.

Thank you, guy!