我需要使用 Internet Explorer 浏览 URL,并通过 TCL 脚本使用 taskkill 关闭。为此,我正在使用以下 TCL 脚本。
我的 TCL 脚本:
set data [open input_url.txt r]
set test [read $data]
foreach url $test {
exec "C:/Program Files/Internet Explorer/IEXPLORE.EXE" $url
after 2000
exec "C:/WINDOWS/System32/taskkill.exe" /IM IEXPLORE.EXE /F
}
input_url.txt 内容:
clickshare upload.com upload.to 10upload.com 123upload.pl 139pan.com 163pan.com
但是当我运行这个脚本时,会打开第一个 URL 的浏览器。但在这之后什么都没有发生。2-3 分钟后,如果我手动关闭浏览器,我会看到以下错误:
C:\Users\kumar\Desktop\test>tclsh stack_question.tcl
child process exited abnormally
while executing
"exec "C:/Program Files/Internet Explorer/IEXPLORE.EXE" $url"
("foreach" body line 2)
invoked from within
"foreach url $test {
exec "C:/Program Files/Internet Explorer/IEXPLORE.EXE" $url
after 2000
exec "C:/WINDOWS/System32/taskkill.exe" /IM IEXPLO..."
(file "stack_question.tcl" line 3)
C:\Users\kumar\Desktop\test>
我可以使用 taskkill.exe 手动终止浏览器会话,如下所示:
C:\Users\kumar\Desktop\test>tclsh
% exec "C:/WINDOWS/System32/taskkill.exe" /IM IEXPLORE.EXE /F
SUCCESS: The process "iexplore.exe" with PID 3948 has been terminated.
SUCCESS: The process "iexplore.exe" with PID 3744 has been terminated.
%
有人可以帮我解决这个问题吗?
提前致谢。