我有一个批处理文件,必须启动Internet Explorer并打开www.google.com。当整个页面加载完成时,它应该终止IE进程,即关闭该系统中IE的所有实例。我的批处理文件有以下两行。
iexplore.exe "www.google.com"
taskkill /IM iexplore.exe /F
但是加载后不会关闭IE实例。
如果我只有一行单独的批处理文件taskkill / IM iexplore.exe / F。该批处理文件关闭IE实例。
第一批文件中出了什么问题。
P.S批处理文件位于程序文件的Internet Explorer文件夹中。
我不完全了解您打算立即打开并关闭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
[并且,如果您希望看到更多的功能,例如如何启动一个进程以及如何一次杀死一个或多个进程,这些功能可以通过动态菜单与用户输入进行交互,那么您应该看一下这篇文章==>How to check and correct user input when he omit the extension .exe to kill the process?
尝试此替代方法时,无需得到用户输入的确认:
@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
有某种方法只能关闭3个窗口之一。例如。我已经打开google.com,https://stackoverflow.com/和facebook.com。那么我可以在iexplore浏览器上仅杀死google.com和facebook.com窗口吗?如何?