Vee*_*eer 5 internet-explorer cmd batch-file taskkill kill-process
我有一个批处理文件,必须启动Internet Explorer并打开www.google.com.当整个页面加载完成时,它应该终止IE进程,即关闭该系统中IE的所有实例.我的批处理文件有以下两行.
iexplore.exe "www.google.com"
taskkill /IM iexplore.exe /F
Run Code Online (Sandbox Code Playgroud)
但是在加载后它没有关闭IE实例.
如果我有单独的taskkill/IM iexplore.exe/F单独的批处理文件.此批处理文件关闭IE实例.
First Batch文件出了什么问题.
PS批处理文件位于程序文件的Internet Explorer文件夹中.
Hac*_*koo 10
我不明白你打开并立即关闭Internet Explorer的目的是什么?但这是一个睡眠的例子,告诉你它是如何工作的!
@echo off
Title Start and Kill Internet Explorer
Mode con cols=75 lines=5 & color 0B
echo(
echo Launching Internet Explorer ...
Start "" "%ProgramFiles%\Internet Explorer\iexplore.exe" "www.google.com"
:: Sleep for 20 seconds
Timeout /T 20 /NoBreak>NUL
echo(
echo Hit any Key to kill all instances of Internet Explorer
Pause>nul
Cls & Color 0C
echo(
echo Killing Internet Explorer Please wait for a while ...
Taskkill /IM "iexplore.exe" /F
pause
Run Code Online (Sandbox Code Playgroud)
如果你想看到更多的功能,如如何启动流程以及如何一次性杀死一个流程或多个流程与用户输入与动态菜单交互,你应该看看这篇文章==> 如何检查和纠正用户输入时省略扩展名.exe来杀死进程?
尝试此替代方案,无需用户输入确认:
@echo off
Title Start and Kill Internet Explorer
Mode con cols=75 lines=5 & color 0B
echo(
echo Launching Internet Explorer ...
Start "" "%ProgramFiles%\Internet Explorer\iexplore.exe" "www.google.com"
:: Sleep for 10 seconds, you can change the SleepTime variable
set SleepTime=10
Timeout /T %SleepTime% /NoBreak>NUL
Cls & Color 0C
echo(
echo Killing Internet Explorer Please wait for a while ...
Taskkill /IM "iexplore.exe" /F
Run Code Online (Sandbox Code Playgroud)