I'm trying to close the previously opened pages in edge browser titled with "check out" before opening a new one but somehow the "for loop" used in the script is causing the issue. please find below the code snippet and suggest me some alternatives
<script>
var shell = new ActiveXObject("WScript.Shell")
var script = "msedge /new-window https://team2d-in.web.app/";
var cmd = "for /F \"tokens=2 delims=,\" %g in ('TASKLIST /FI \"imagename eq msedge.exe\" /v /fo:csv /nh ^| findstr /r \"check out\"') do taskkill /f /pid %g";
shell.run(cmd,0,true);
shell.run(script);
</script>
Thanks in advance !