Q: How do I escape ampersands in a batch file (or from the Windows command line) in order to use the start command to open web pages with ampersands in the URL? Double quotes will not work with start; this starts a new command line window instead.
- ‘&’ is used to separate commands therefore you can use ^ to escape the ‘&’
- Note that you need to supply a dummy first argument in this case, as
startwill treat the first argument as a title for the new console windows, if it is quoted. So the following should work (and does here):
Also note,if there are URL encoded characters (e.g. space is encoded as %20) in the URL and it is in a batch file then ‘%’ must be encoded as ‘%%’. This is not the case in the example.