function extractArgs(str) { //return an array of unquoted arguments from the command line. //we either want non quote stuff ([^"]+) surrounded by quotes or we want to look-ahead, //see that the next character isn't a quoted argument, and then grab all the non-space //stuff this will return for the line: "foo" bar the results "\"foo\"" and "bar" var matches = str.match(/((?!"([^"]+)")\b(\S+)\b|"([^"]+)")/g) //unquote the quoted arguments: var args = new Array() for(var i=0;i<matches.length;i++) { args[i] = matches[i] args[i] = args[i].replace(/^"(.*)"$/, "$1") } return(args) } You'll probably want to try to rewrite the getQueryParameter function to use extractArgs instead of location.search if you need to use this trick. function getQueryParameter(searchKey) { var args = extractArgs(HTA_ID_Attribute.commandLine) var clauses = args[1].split('&') for(var i=0;i<clauses.length;i++) { var keyValuePair = clauses[i].split('=',2) var key = keyValuePair[0] if(key==searchKey) { return(keyValuePair[1]) } } return(null) } That way you can invoke your hta from the command line like this: x.hta one=two&foo=bar and getQueryParameter("foo") will return "bar". You still can't do this from a file URL, because file URLs don't take command line arguments. (It's really something of an abuse of the file URL argument to open a program like .BAT, .HTA or .EXE using the file URL, but many people do it anyway.)