I need to browse a URL using Internet Explorer, and close using taskkill through TCL script. I am using following TCL script for this.
My TCL Script:
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 content:
clickshare upload.com upload.to 10upload.com 123upload.pl 139pan.com 163pan.com
But When I run this script, Browser with first URL is opened. But nothing is happening after this. After 2-3 minutes, if I close the browser manually, I am seeing the following error:
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>
I am able to kill the browser session manually using taskkill.exe as shown below:
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.
%
Could any one please help me to fix this issue?
Thanks in advance.
It seems like
exec
is waiting foriexplore.exe
to finish before it continues execution. In order to allow immediate return usestart
command:This will return immediately.