{"id":205,"date":"2007-12-24T13:52:21","date_gmt":"2007-12-24T01:52:21","guid":{"rendered":"http:\/\/craig.dubculture.co.nz\/blog\/2007\/12\/24\/parsing-quotes-in-cmdexe\/"},"modified":"2007-12-24T14:02:23","modified_gmt":"2007-12-24T02:02:23","slug":"parsing-quotes-in-cmdexe","status":"publish","type":"post","link":"http:\/\/craig.dubculture.co.nz\/blog\/2007\/12\/24\/parsing-quotes-in-cmdexe\/","title":{"rendered":"Parsing quotes in cmd.exe"},"content":{"rendered":"<p>The Microsoft world can be horribly inconsistent.  Take escaping a quote character:<\/p>\n<ul>\n<li>\"\" in VB and SQL Server<\/li>\n<li>\\\" in C++\/C#<\/li>\n<li>Unless you use a @ symbol first, in which case you have to use \"\" as \\ won't be interpreted as an escape character<\/li>\n<\/ul>\n<p>It never seemed at all you could escape characters on a command line.  Until, of course, you go to do something like this:<\/p>\n<pre>\r\nrem xcopy is old, let's not use it any more\r\nrem the backslash on the end of bar tells xcopy\r\nrem that it's a directory, not a file, it's copying to\r\nrem\r\nrem xcopy \/e \"C:\\foo\\\" \"C:\\bar\\\"\r\nrobocopy \"C:\\foo\" \"C:\\bar\\\" \/e \/x \"Extra Options\"<\/pre>\n<p>Whereupon the much newer program parses the output as follows:<\/p>\n<pre>\r\nsource=C:\\foo\r\ndestination=C:\\bar\" \/e \/x \"Extra Options\"<\/pre>\n<p>This is a problem with anything that uses the .NET framework also.  Watch your trailing slashes!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Microsoft world can be horribly inconsistent. Take escaping a quote character: \"\" in VB and SQL Server \\\" in C++\/C# Unless you use a @ symbol first, in which case you have to use \"\" as \\ won't be interpreted as an escape character It never seemed at all you could escape characters on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[66,68],"tags":[27,4],"_links":{"self":[{"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/posts\/205"}],"collection":[{"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=205"}],"version-history":[{"count":0,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/posts\/205\/revisions"}],"wp:attachment":[{"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/craig.dubculture.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}