batch file - Removing quotation marks from beginning and end of a string containing HTML -
I try to replace some placeholder tags in a HTML document using a windows batch file, with HTML formatted text I am here. Except that the batch works fine it includes quotation marks at the beginning of the replaced text
Here's what I have so far:.
setlocal DisableDelayedExpansion set INTEXTFILE off @echo = test.txt OUTTEXTFILE set = set test_out.txt SEARCHTEXT = placeholder set REPLACETEXT = "replaced & lt; a href =" http: // www. Website.com "target =" window "> Text on your head and tail"% 1, -1% set for OUTPUTLINE = / F "token = 1, * dellimus = ¶" a ( "type %%% INTEXTFILE% ') (sET string = %% a Setlokl EnableDelayedExpension sET = revised! = string:% SEARCHTEXT% =% REPLACETEXT%! set variable =! variable: ~ 1, -4!) & Gt; & Gt; % OUTTEXTFILE% echo (! Modified endlocal!) Dale% INTEXTFILE% rename% OUTTEXTFILE %% INTEXTFILE%
The output looks like this:
"It will take place
Any ideas about how to extract the first quotation mark in the output text without affecting the HTML formatting? Thanks!
checked but this is the basic idea
setlocal DisableDelayedExpansion set "INTEXTFILE = test.txt" set "Close @ Echo OUTTEXTFILE = test_out .txt "set" SEARCHTEXT = PLACE HOLDER "set" REPLACETEXT = This has been replaced & lt; A href = "http://www.website.com" target = "window" & gt; Text & lt; / A & gt; = 1 token on its head and tail, * delims = "/ scheduled f OUTPUTLINE =" "%% in (" Type% INTEXTFILE% A string = %% A Setlocal EnableDelayedExpansion set "modified") is set ( "! = string:% SEARCHTEXT% =% REPLACETEXT%" & gt; & gt; "% OUTTEXTFILE%" (! modified endlocal) echo Dell "% INTEXTFILE%" rename "% OUTTEXTFILE%" "% INTEXTFILE%" < / Code>
Comments
Post a Comment