Problems checking if string is quoted and adding quotes to string
问题 I am trying to check if a string is quoted by checking the first and last characters of the string. But my script fails when checking for the quote see output: AND was unexpected at this time. below. Code @echo off set mystring=Non quoted string set myquotedstring=^"My quoted string^" echo mystring: %mystring% echo myquotedstring: %myquotedstring% set result=%mystring:~0,1% echo first character of non quoted string is: %result% set result=%mystring:~-1% echo last character of non quoted