HTA - 处理命令行输入参数

<head>

...

<script>

...

function remove_repeat_newspace(str) {
  var arr = str.split("");
  var newarr = [];
  var len = arr.length;
  var cnt = 0;
  for (var i = 0; i < len; i++)
  {
      if (arr[i] != " "){
        cnt = 0;
        newarr.push(arr[i]);
      }
     else {
        if (cnt < 1){
          newarr.push(arr[i]);
        }
        cnt++;
     }
   }
   var newstr = newarr.join("");
   return newstr;
}

</script>

</head>

<body>

...

<script>

var str = JSCALLHTA.commandLine;
var str2 = remove_repeat_newspace(str);
var args = str2.split(" ");
var tmp;
for (i = 0; i<args.length; ++i){
   tmp = args[i] + "<br/>";
   document.write(tmp);
}

//save_resolve(args[1],args[2]);
...

</script>

</body>

 
posted @ 2018-09-21 20:30  Reboost  阅读(555)  评论(0编辑  收藏  举报