What's the proper way to shut down all of the instances of internet explorer for the current user using batch commands? I have this. There can be multiple users logged into the same computer. What am I missing?
taskkill /IM iexplore.exe
TASKKILL does support filtering by username, but it's not with the /U
switch, as @Wutnaut suggested. Try this:
TASKKILL /FI "USERNAME EQ %USERDOMAIN%\%USERNAME%" /IM IEXPLORE.EXE
The /FI
switch allows filtering based on several properties. Here, we're calling the %USERDOMAIN%
and %USERNAME%
environment variables to get the current user's identity for that filter.
In any case, the filter should not be necessary if you're running from a non-elevated command prompt. Without elevation, you should not be able to control the processes of other users. (This may be dependent on the rights of the current user on the system, and the UAC configuration.)
You may also want to consider adding /T
to catch any child processes of Internet Explorer, and/or /F
to forcefully terminate everything in case something's hung.
Run TASKKILL /?
to get more information about these switches, and proper syntax.
/U
switch only specifies the user context under which the command should run - it doesn't necessarily filter its effectiveness down to processes run only by that user. Easy fix: Don't run it as an Administrator.